Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

M2E: Version is duplicate of parent version - Why is this a warning?

I have several Maven projects that each have some common functionality or at least common configuration/dependencies. I extracted this in to a common pom.xml, and then modularlized several facets, for example persistence, Spring related dependencies, and so on - all in their own modules which inherit from this parent POM.

Right now, "Common" is version 1.0.0 and I have "ProjectA" that I wish to inherit from it. I receive the warning:

Version is duplicate of parent version

I don't fully understand why this is a warning. I thought I had the option of omitting the version from my project POM in order to inherit the version. (I do this for common modules - for example, common-spring adds additional common dependencies for Spring apps, and in fact, ProjectA actually inherits from common-spring.)

Isn't it just that - an option? If I change my ProjectA version to 1.0.1 or 2.0.0 all is well.

like image 731
Doug Moscrop Avatar asked Nov 24 '11 22:11

Doug Moscrop


2 Answers

Newer versions of m2e (since 1.1) now allow you to disable this warning.

Preferences > Maven > Warnings > Disable "Version is duplicate of parent version" warning

Original bug report: https://bugs.eclipse.org/bugs/show_bug.cgi?id=356796

like image 188
Duncan Jones Avatar answered Oct 13 '22 01:10

Duncan Jones


It´s just m2e trying to be clever because the version element (like group id) sometimes can be redundant and be can be inherited from the parent POM, so it would be safe to remove this element from your child POM.

But sometimes this is not a redundant information, like when the parent and the child project have different life cycles, and m2e should allow this warning to be disabled. Unfortunately there is no way to do this yet: http://dev.eclipse.org/mhonarc/lists/m2e-users/msg01961.html

UPDATE: As Duncan says bellow, in newer versions you can disable this warning.

like image 33
Fabricio Lemos Avatar answered Oct 13 '22 00:10

Fabricio Lemos