开发者

Maven: retrieving the main module version from a sub-module

开发者 https://www.devze.com 2023-03-25 04:08 出处:网络
My Maven projects are multi-module and in general the version numbers are not synced. For instance, I can have a master POM versioned as 1.2.3-SNAPSHOT and a sub-module versioned 3.4.5-SNAPSHOT (the m

My Maven projects are multi-module and in general the version numbers are not synced. For instance, I can have a master POM versioned as 1.2.3-SNAPSHOT and a sub-module versioned 3.4.5-SNAPSHOT (the main reason for not keeping them synced is that often a module is moved from a project to another and it has to keep its version).

Now I want to put the main project version in a resource of the module containing the main (or the webapp, etc...), which of course is a sub-module. This means that I need to access the master pom versi开发者_如何转开发on from a sub-module.

Also be aware that my projects have got 3 or 4 levels; thus the master pom is the grandfather of the submodule, not just the parent.

In spite of having some experience with Maven including advanced stuff, so far I've been unable to solve this problem.

Thanks.


It should work with ${project.parent.version}.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号