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.

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,
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.