Reputation: 73
I'm currently refactoring lots of pom.xml in various projects and git repo. Sometimes, a pom in a project A will require an artifact defined in a project B in a version defined by a property :
<dependency>
<groupId>com.example</groupId>
<artifactId>artifact-from-b</artifactId>
<version>${version.from.somewhere}</version>
</dependency>
Sometimes, the version property is not obviously defined in the pom itself or its parent pom. It can be hidden in a parent's parent's parent...
I'm currently trying to find a way to resolve easily properties like ${version.from.somewhere} and find where it is defined.
Any idea of any tool that can help me (apart from eclipse, which fails for some tricky properties) ?
Thanks !
Upvotes: 6
Views: 1553
Reputation: 7649
There is a related answer here Is there a way to trace origin of a property in maven pom?
That suggest using mvn help:effective-pom -Dverbose=true
then you can find comments like com.example.model:2.1.0-SNAPSHOT
.
I tried it and it worked for me.
In my case, the property is defined in the pom of com.example.model:2.1.0-SNAPSHOT
in line 407
<dependency>
<groupId>com.example</groupId> <!-- com.example.model:2.1.0-SNAPSHOT, line 405 -->
<artifactId>model</artifactId> <!-- com.example.model:2.1.0-SNAPSHOT, line 406 -->
<version>1.0.6</version> <!-- com.example.model:2.1.0-SNAPSHOT, line 407 -->
Upvotes: 6