I'm creating a custom rule via the enforcer plugin but I've ran into a snag
with the following:
I want to find a dependency that explicitly declares (not implicitly) a
version defined. Also, that dependency is defined as a dependencyManagement
defined dependency in a root pom.
I want to find the following:
<dependencies>
<dependency>
<groupId>my.company</groupId>
<artifactId>commons-core</artifactId>
<version>1.2</version> (FIND THIS ACTUALLY IN THE POM.)
</dependency>
</dependencies>
When declaring the following:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>my.company</groupId>
<artifactId>commons-core</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</dependencyManagement>
and:
<dependencies>
<dependency>
<groupId>my.company</groupId>
<artifactId>commons-core</artifactId>
</dependency>
</dependencies>
Is there a way where I can get the exact contents of what is explicitly
declared for the dependency?
I've tried several "get methods from the MavenProject object that return
artifacts or dependency objects, but they all have the version declared (or
generated via the DM declared version) even if I explicitly define the
version or have it removed and the DM defined version, is supplied
indirectly to the artifact when returned.
Any thoughts? I posted my initial thoughts of a feature to enforcer on the
dev list, but now trying to build this feature out.
Thanks,
Nick