Update
Plugin management is a mechanism for sharing default configuration of a plugin (from parent or same project) and it gets overridden by the values in your effective pom build plugins
section, so that is not the solution.
It can be that you have a profile in your pom which gets activated and it overrides the plugin version value (see below under debug, read your effective pom). Comment out (<!--
, -->
) the profile node in your pom and rerun the build if so.
If this is the cause, you can deactivate the profile in your pom or when running from command line just append -P !<PROFILE_NAME>
or -P \!<PROFILE_NAME>
for linux.
More specifically if your pom looks like this:
<project>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>someGroupId</groupId>
<artifactId>someArtifactId</artifactId>
<version>versionFromPluginManagement</version>
...
</pluginManagement>
<plugins>
<plugin>
<groupId>someGroupId</groupId>
<artifactId>someArtifactId</artifactId>
<version>versionFromPlugins</version>
...
</build>
<profiles>
<profile>
<activation>
<activeByDefault>BOOLEAN_STRING</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>someGroupId</groupId>
<artifactId>someArtifactId</artifactId>
<version>versionFromProfile</version>
...
</project>
Artifact someGroupId:someArtifactId
is defined in the pluginManagement
, plugins
, and profiles
section.
The version resolution goes:
- if
versionFromPlugins
isn't defined and BOOLEAN_STRING is false
then the resulting version is versionFromPluginManagement
- if
versionFromPlugins
is defined and BOOLEAN_STRING is false
then the resulting version is versionFromPlugins
- if BOOLEAN_STRING is
true
then the resulting version is versionFromProfile
If that is not so, then please run:
mvn help:effective-pom > pom.log
mvn help:effective-settings > settings.log
mvn -version > environment.log
and post contents here.
Original answer
Is there some global maven settings file that trumps local pom file configuration?
Yes, there is. There are at least two of them actually: the global one in the maven installation folder, and the per-user one next to the local repository folder.
When you run maven against your project it interpolates those two files with your pom file, and calculates the resulting one which will be applied when building the project.
Debugging
mvn -X clean compile > build.log
- run maven with verbose output with -X
(debug) command line flag. Since there is a lot of output it is recommended to pipe it (>
) to a file. This is especially helpful when using plugins with erroneous documentation as you can see all the plugin properties and their actual values prior to their execution.
mvn help:effective-pom > pom.log
calculates the pom which will be applied when building your project. It also shows the active profiles.
mvn help:effective-settings > settings.log
calculates the settings which will be applied when building your project
First examine your effective pom, then debug output and finally the effective settings.
Environment
Rarely, the problem can be in the environment. You must be aware that maven uses java, so you'll need these to know your actual environment:
java -version
mvn -version
Maven knows its environment by the following environment variables (see its install instructions):
M2_HOME
- absolute path to maven installation folder root
M2
- the bin
folder of the above, that's where maven executable is
JAVA_HOME
-absoulte path to JDK installation folder root - by changing this value you change the Java which Maven uses
Of course, all three variables must be in the PATH environment variable.