Phate
Phate

Reputation: 6602

Only use parent for dependencies inheritance, possible?

I usually define a parent pom to inherit the dependencies and the builds. Problem is that I keep getting warnings about redundant groupId, version, ecc. as it seems that my inherited pom should stick to parent's.

I don't want that: is there any way to tell maven "I want the children to be independent"?

<parent>
    <groupId>com.foo</groupId>
    <artifactId>parent</artifactId>
    <version>0.0.1-SNAPSHOT</version> <!-- this is fine -->
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>com.foo.agroup</groupId> <!-- this is not: I should keep com.foo -->
<artifactId>child</artifactId>
<version>1.0</version> <!-- this is not as well: I should keep 0.0.1-SNAPSHOT -->

Upvotes: 1

Views: 66

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35785

What you did in your question is perfectly right. Don't change it.

If you are not in a multi-module project, it is a common approach to not use the groupId or version of the parent. We do this all the time.

I just wonder where you warnings come from. Are they in the Maven build? Or in Eclipse?

Could be please copy/paste them so we can inspect them.

Summarised: Your POM is fine, the warnings are just noise or rubbish (as long as you are not in a multi-module project).

Upvotes: 1

Related Questions