Maven 3 need to know the plugin version
In Maven 2, if you didn’t specify the version for each plugins that used in pom.xml
, it will pick the latest plugin version automatically, which is very convenient. However, in Maven 3, if you didn’t explicitly specify the plugin version, it will prompt you warning message. Read this “Maven 3 compatibility” for detail.
For example, in Maven 2, normally, we use the “maven-compiler-plugin
” plugin without specifying the version, and it’s 100% valid.
//...pom.xml in Maven 2
<build>
<finalName>SpringMVC</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
//...
However, in Maven 3, above declaration will prompt you following “WARNING” messages :
[INFO] Scanning for projects...
[WARNING] Some problems were encountered while building the effective model
for com.mkyong.common:SpringMVC:war:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin
is missing. @ line 55, column 12
[WARNING] It is highly recommended to fix these problems because they threaten
the stability of your build.
[WARNING] For this reason, future Maven versions might no longer support
building such malformed projects.
To fix it, just specify the plugin version like this :
//...pom.xml in Maven 3
<build>
<finalName>SpringMVC</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
How to know what’s the Maven’s plugin version?
You can try search the plugin at http://search.maven.org/ , or visit the plugin website, for example – Maven compiler plugin official website.
You can try search the plugin at http://search.maven.org/ , or visit the plugin website, for example – Maven compiler plugin official website.
It worked ..thanks 🙂
Hi,
I am getting below issue could you please some one help me on this..
[WARNING] Some problems were encountered while building the effective model for XXXdao:XXXdao:jar:1.0.0
[WARNING] ‘dependencies.dependency.systemPath’ for com.companyname.env:thirdparty.jar should not point at files within the project directory, ${basedir}/lib/thirdparty.jar will be unresolvable by dependent projects @ line 69, column 15
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
What happens if I do not have any reference to plugin in my pom.xml? For example, in my <plugin management> section there is no maven-deploy-plugin. Actually 2.7 is invoked at deploy phase, although latest version is 2.8.1. How does Maven determine the version to use?
hi yong,
i dunno whether i can post this question here or not but the following error is killing me. i am trying to create a maven web project in eclipse and i want it to run on java version 1.6.0_26. when i built the project without any java classes, it was good, but when i created a java sample class and tried to run then this wierd error showed up.
[INFO] — maven-compiler-plugin:2.3.2:compile (default-compile) @ GetDetailsSample —
[INFO] Compiling 1 source file to F:\codercharts\GetDetailsSample\target\classes
[INFO] ————————————————————-
[ERROR] COMPILATION ERROR :
[INFO] ————————————————————-
[ERROR] Failure executing javac, but could not parse the error:
javac: invalid target release: 1.6.0_26
Usage: javac
use -help for a list of possible options
[INFO] 1 error
[INFO] ————————————————————-
[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Total time: 24.785s
[INFO] Finished at: Sat Jun 29 14:56:41 IST 2013
[INFO] Final Memory: 8M/23M
[INFO] ————————————————————————
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project GetDetailsSample: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR] javac: invalid target release: 1.6.0_26
[ERROR] Usage: javac
[ERROR] use -help for a list of possible options
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
any help is appreciated… 🙁 🙁
Isn’t this a catch 22 ?
I often find that I would like to set some configuration for a plugin. But what I do NOT want to do is to pin that to certain plugin version because it becomes static or at least I have no intention of overriding Maven’s default setup as to which plugin version to use. (where does it get that from anyway? it is not in the super-pom).
I recently wanted to set such configuration for the maven-compiler-plugin. So I did like this:
org.apache.maven.plugins
maven-compiler-plugin
some-dated-old-version
…
I made a mistake in the version number and happened to pick a very old version of the plugin. Suddenly builds stopped working that had been working before. This was due to subtle differences between the plugin version my Maven by default was using before and the one I accidentally forced it to use by mistake.
And all I wanted to do was to set some configuration. Ouch !
This was with Maven 3.0.4.
The plugins version number can be checked here: http://maven.apache.org/plugins/index.html
Hello,
I’d like to ask you about maven-compiler-plugin
I had some issues couple of days ago related with choosing java version for the maven-compiler-plugin and finally I resolved an issue by changing JDK from 1.5 to 1.6.
I simply had error thrown by maven compile goal like that:
“Bad version number in .class file” Is there a Maven plugin to …
I simply resolved this by changing the java version to 1.6, However it took me lots of time to resolve it.
Could you answer on the following question?
1. Is it any connection between compiler plugin and jdk version?
If so, then what java version should I use if I want to use
maven-compiler-lugin version e.g. 2.5.1
I have to mention that I have no doubt why I could compile the two projects when I changed JDK version.
Please, could you explain this for me?
Thanks a lot,
Hi I am getting below issue could you please some one help me on this..
[WARNING] Some problems were encountered while building the effective model for XXXdao:XXXdao:jar:1.0.0
[WARNING] ‘dependencies.dependency.systemPath’ for com.companyname.env:thirdparty.jar should not point at files within the project directory, ${basedir}/lib/thirdparty.jar will be unresolvable by dependent projects @ line 69, column 15
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
Hello Mr. Mkyong…Thanks for sharing your knowlwdge.. Its quite helpful
Just had one question: In the above post while writing about Maven 3 , in the pom.xml you have mentioned:-
Well this appears wrong to me.. Can you please confirm…I believe it should be something like :
The version belongs to
maven-compiler-plugin
, 2.3.2 is valid, you can check all the released at the Maven central repository – http://search.maven.org/Did a quick check, the latest released is version 3.0.