How to configure maven or eclipse in order to use

2019-05-26 06:42发布

All our projects are built using maven. we have centralized some of our main configuration within a super pom.

In order to always have an update version of this super pom (without having to modify the version), we have used the following syntax :

<parent>
    <groupId>my.organization</groupId>
    <artifactId>superPom</artifactId>
    <version>RELEASE</version>
</parent>

The problem is that Maven Eclipse plugin (m2e) doesn't understand this syntax (the RELEASE constant is not resolved). So, our Eclipse users can't use built-in compilation.

What do you suggest to overcome this problem ?

By the way, we have tried several options from a maven point of view (especially those described here), but the version.RELEASE is the easiest for everybody (except those who are using Eclipse).

EDIT: Our projects sources are split within multiple SVN repositories. This super pom is an independent project. It is retrieved through our Nexus server.

2条回答
ゆ 、 Hurt°
2楼-- · 2019-05-26 07:02

Version ranges and expansion indeed do not work for parent artifacts.

Someone advised to invoke the version plugin instead :

mvn versions:update-parent 

which does not cover exactly your need, but I am afraid there is no better workaround. Other ideas : using a SNAPSHOT parent pom (not very satisfactory I admit). See also Maven2 cannot find parent from relative path.

查看更多
干净又极端
3楼-- · 2019-05-26 07:07

You are trying to go into the wrong direction. A release in maven is a particular version like 1.0.0 and it indicates that you have a defined state of that artifact. In your case you super pom has a particular state. If you are trying to define the version to "RELEASE" you are saying my release is always the same but in reallity it's not true.

Usually such a super pom will change over the time lets say today you have defined some particular dependency versions in it (dependencyManagemet). And tomorrow you change those definition. Now the 1.000.000$ questions which state of the super pom is used in a build which has been done today? Ok in that simple scenario you can answer the question but if you have changed the super pom sometime yesterday you can't answer the question accurately.

Furthermore if you try to recreate an artifact of let's say last week you can't say which exact state of super pom has been used at that particular time cause you have no indicator which gives you the chance to see it.

And that's the reason why you need real versions like 1.0.0 or 1.1.0 etc.

I can strongly recomment to use real versions like 1.0.0 etc. but NOT things like "RELEASE" that will creep in the Maven system with its corrdinate group, artifact and version.

查看更多
登录 后发表回答