Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
0.4.0
-
None
Description
The Yetus audience-annotations module uses a jdk profile in the parent yetus-project pom to define the tool.jar to use in the dependency management section:
...
<dependencies>
<dependency>
<!-- Version and location set in project pom -->
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<scope>system</scope>
<!-- Mark as optional so that it isn't taken transitively -->
<optional>true</optional>
</dependency>
</dependencies>
...
... <profiles> <profile> <id>jdk1.7</id> <activation> <jdk>1.7</jdk> </activation> <dependencyManagement> <dependencies> <dependency> <groupId>jdk.tools</groupId> <artifactId>jdk.tools</artifactId> <version>1.7</version> <scope>system</scope> <systemPath>${java.home}/../lib/tools.jar</systemPath> </dependency> </dependencies> </dependencyManagement> </profile> ...
This causes issues when trying to download the maven dependency via a gradle project because gradle does not support jdk profile activation and views profile activation requirements as a reproducibility anti-pattern to be avoided. (source).
The issue seen in a gradle build is below:
> Could not resolve org.apache.yetus:audience-annotations:0.4.0. Required by: ... > Could not resolve org.apache.yetus:audience-annotations:0.4.0. > Could not parse POM https://repo1.maven.org/maven2/org/apache/yetus/audience-annotations/0.4.0/audience-annotations-0.4.0.pom > Unable to resolve version for dependency 'jdk.tools:jdk.tools:jar'
This occurs because without any default version and no jdk profile activated jdk.tools is an invalid dependency. Given that its optional, it could simply be ignored. However, gradle has no way to force this even if setting the transitive = false property.
This is easily fixed by adding a default dependency when no jdk profile is activated.