Configuring Java version in a Maven based app

There’s a couple of different ways to configure the Java version for an app in your Maven pom.xml file.

The simplest is with the following properties:


If you’re configuring a Spring Boot app with Maven, you can also use this single property (only works for a Spring Boot app using the starter parent spring-boot-starter-parent) to override the Spring Boot default:


Skipping tests during Maven phases

If you’re running a Maven phase/goal and need to skip the execution of tests (because they’re temporarily failing), add one of the following options:

mvn -DskipTests phasename
mvn -Dmaven.test.skip=true phasename

Normally you’d only continue with the build if the tests are passing, but sometimes you may have a valid reason to force the build to continue regardless.

These options are covered in the Maven docs here.

Maven vs Gradle equivalent commands

I’ve seen Gradle becoming more popular in recent years, but it wasn’t too long ago that Maven was the tool for managing dependencies and building/packaging apps.

From my own experience with both, here’s the commonly used equivalent commands:

mvn compileNo equivalent as gradle build compiles and packages?
mvn packagegradle build
mvn install (see note below)gradle build
mvn testgradle test

There is no direct equivalent to ‘mvn install’ in gradle, but if you depend on a local Maven repo, there is a Gradle plugin to publish packaged artifacts to a Maven repo – see here.

Installing Maven tool support in vanilla Eclipse IDE

If you download an Eclipse bundle like the Eclipse IDE for Java EE developers, you’ll get Maven support built in, but if you download a vanilla Eclipse install (like from using from of the daily builds), you’ll need to install many pllugins yourself.

Eclipse support for Maven is provided via the m2Eclipse plugin, there are installation instructions here:

I’ve had luck using these installer buttons before, but on this daily build for M1 they don’t seem to do anything. Instead I used the manual approach by adding a new ‘site’ in ‘Add New Software, ‘ adding and then selecting ‘Maven Integration for Eclipse’ :