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.

References

  1. Maven 3 compatibility
  2. Maven compiler plugin

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
Rifath Fathima
Guest
Rifath Fathima

It worked ..thanks :)

VG
Guest
VG

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.

alex
Guest
alex

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?

sekhar
Guest
sekhar
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… Read more »
sekhar
Guest
sekhar

any help is appreciated… :( :(

Ejnarr
Guest
Ejnarr
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… Read more »
Chris
Guest
Chris

The plugins version number can be checked here: http://maven.apache.org/plugins/index.html

Pawel
Guest
Pawel
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?… Read more »
VG
Guest
VG

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.

Amit
Guest
Amit

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:-

 <version>2.3.2</version> 

Well this appears wrong to me.. Can you please confirm…I believe it should be something like :

 <version>3.0.3</version>