Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the consequence of leaving out Maven plugin version?

Tags:

maven

[WARNING] 'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-clover-plugin is missing. @ com...

I'm in the process of resurrecting an old Maven project. Some / most of the Maven plugin dependencies has been configured without version. Apart from the warning, what is the consequences of this? Will Maven attempt to find the most recent version and by that increase build time?

like image 575
Kimble Avatar asked Jan 03 '12 11:01

Kimble


People also ask

What happens if we don't specify version in Pom?

That being said, if the version is not given, then the version provided in the dependencyManagement or the parent pom will be used. For example: in the pom (only important sections are mentioned) given below, no version is provided for the artifact jstl.

Why do we need Maven plugin?

Plugins are the central feature of Maven that allow for the reuse of common build logic across multiple projects. They do this by executing an "action" (i.e. creating a WAR file or compiling unit tests) in the context of a project's description - the Project Object Model (POM).

What is Maven plugin version?

Maven Plugin Plugin/ | Last Published: 2022-01-11. Version: 3.6.4.

How do I exclude a specific version of a dependency in Maven?

You can click the tabs on the bottom to explore dependencies, then r click on one and say “exclude”.


1 Answers

Will Maven attempt to find the most recent version and by that increase build time?

Yes, when version is omitted, maven tries to find and uses the most recent version. This was actually a bad design choice, but not because of the build time (I think it caches plugins and only updates them once in a while).

The real problem here is that you never know which version of the plugin was used and will the plugin behave the same in the future. This makes builds unrepeatable.

For instance if some plugin changes the defaults for some options, the exact same source with exact same pom.xml will produce different results.

The developers of maven are trying to fix this design flaw by first warning you that you should specify plugin version explicitly. After all it is safer to use outdated plugin rather than a brand new one than suddenly breaks your build.

like image 190
Tomasz Nurkiewicz Avatar answered Sep 21 '22 02:09

Tomasz Nurkiewicz