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

I have several Maven projects, each of which has some common functionality, or at least a common configuration / dependency. I extracted this into a generic pom.xml and then modeled several faces, such as persistence, Spring dependencies, etc. - all in their own modules that inherit from this parent POM.

Right now, โ€œCommonโ€ is version 1.0.0, and I have โ€œProjectAโ€ that I want to inherit from it. I get a warning:

Version is a duplicate of the parent version

I do not quite understand why this is a warning. I thought I had the opportunity to omit the version from my POM project in order to inherit the version. (I do this for general modules - for example, common-spring adds additional common dependencies for Spring applications, and in fact ProjectA actually inherits from common-spring.)

Isn't that an option? If I change my version of ProjectA to 1.0.1 or 2.0.0, everything will be fine.

+43
eclipse maven m2e parent-pom
Nov 24 2018-11-11T00:
source share
3 answers

This is just a tag that is trying to be smart because a version element (like a group identifier) โ€‹โ€‹can sometimes be redundant and can be inherited from the parent POM, so it would be safe to remove that element from your child POM.

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

UPDATE: As Duncan says, in new versions you can turn off this warning.

+49
Dec 16 '11 at 18:40
source share
โ€” -

Newer versions of m2e (starting with version 1.1) now allow you to disable this warning.

Settings> Maven> Alerts> Disable the warning "Version is a duplicate of the parent version"

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

+49
03 Oct
source share

If this really annoys you, use the property to suppress the warning with some tricky sleight of hand:

<version>${api.version}</version> <properties> <api.version>0.0.1-SNAPSHOT</api.version> </properties> 

but all you really do is move the warning to console output:

 [WARNING] Some problems were encountered while building the effective model for [project] [WARNING] 'version' contains an expression but should be a constant. 
+2
May 09 '12 at 14:16
source share



All Articles