Tag Archives: maven

Building, tagging and pushing Docker images with Maven

A standard use case for Docker is to build a container to run a pre-built application so that the containerized app can be run on any Docker enabled host. The application and the container are sometimes developed and built separately. First the application is built, then a container is defined and built to include the application. However, it can be better to promote the Docker container to a first-class build artifact. That is, the build process always builds the deployed component and its container at the same time. This saves a manual build step and also ensures that the Docker container is always up to date with the latest application build. It allows us to easily develop and test against the Dockerized application directly – every build results in a new deployable container.

There are a number of ways to do this. This article looks at hooking the Docker tasks into the Maven build process.

No code REST services with Spring Boot and Spring Data REST

CRUD REST services are the backbone of a microservice architecture. If we want to use microservices rather than monolithic applications, it’s essential that we can create a basic service with a minimum of effort. Spring Boot can be used to quickly create and deploy a new web service. Spring Data REST can be used to build out the REST interface based on a database entity model. Using both together allows us to create a running RESTful web service with zero custom Java code and no tricky XML.

This how-to describes how to build a RESTful web service as an executable JAR that provides CRUD operations against a single MySQL database table.

Docker Part 3: Disposable Containers

The previous posts in this series on Docker have looked at running containers to run services, specifically a web server and database server. However, Docker allows containers to be created, run, stopped and destroyed so cheaply that they can be used to run a single job. This job could be a script or even a single command. Unlike a service, a job will stop running when it’s complete. A container running a short lived job can be set to automatically stop and remove itself once the job is complete. If the job needs to be run again, it is reasonably efficient for Docker to start up a brand new container as required.

Deploying to Tomcat 7 with Maven

It may be desirable to have Maven automatically redeploy the application(s) to a test server on builds. This may be useful in a Continuous Integration (CI) scenario where we want some system running the latest build.
In this example, we want Tomcat updated with the latest build whenever we put an updated build in the Maven repository.

Spring MVC Maven Archetype

In less than five minutes and just three Maven commands, I was able to create, compile and run a fully working example Spring MVC application.

Migrating from SVN to Git

This post documents the steps to migrate from SVN files and revision history to Git, specifically in a Windows environment.

Integration Tests with Selenium and tomcat7-maven-plugin

To create an automated integration test of my spanners-struts webapp, I need a way of launching it as part of the Maven build process.

Generate database schema DDL from Hibernate hbm mappings

The hibernate3-maven-plugin can be used to create a schema DDL from Hibernate mapping files

Maven release plugin

If you’re doing this sort of process manually it will take a while. Instead, it can be done by Maven using two goals – release:prepare and release:perform.

Web service testing with soapUI

soapUI is an essential free tool for testing SOAP and other web service protocols. It was particularly useful for testing the SpannersWS demo as it works well with WSS.