I'm noticing that Maven output is reporting plugin version numbers different than what I'm specifying in the pom file.
For example, in my pom I specify the compiler plugin version of 3.1
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</plugin>
But when Maven runs (package, install...whatever) it outputs that it used the version 2.3.2 for the compiler plugin
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile)
Is there some global maven settings file that trumps local pom file configuration?
The best thing to define such thing is to use pluginManagement like this:
This should solve you problem, but I'm not 100% sure, cause i don't have the full pom file.
It seems that Maven ignores the set version if you run
versions:set
andpackage
(or whatever the consuming goal is) in the samemvn
invocation. But running them in separate invocations works.In other words, this works (for me at least):
This does not work:
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:
Artifact
someGroupId:someArtifactId
is defined in thepluginManagement
,plugins
, andprofiles
section. The version resolution goes:versionFromPlugins
isn't defined and BOOLEAN_STRING isfalse
then the resulting version isversionFromPluginManagement
versionFromPlugins
is defined and BOOLEAN_STRING isfalse
then the resulting version isversionFromPlugins
true
then the resulting version isversionFromProfile
If that is not so, then please run:
and post contents here.
Original answer
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 projectFirst 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 rootM2
- thebin
folder of the above, that's where maven executable isJAVA_HOME
-absoulte path to JDK installation folder root - by changing this value you change the Java which Maven usesOf course, all three variables must be in the PATH environment variable.