Uploaded image for project: 'Yetus'
  1. Yetus
  2. YETUS-524

audience-annotations can not be used as a dependency in a gradle build

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.4.0
    • 0.5.0
    • Audience Annotations
    • 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:

      audience-annotations/pom.xml
      ...
      <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>
      ...
      
      yetus-project/pom.xml
      ...
      <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.

      Attachments

        1. YETUS-524.00.patch
          0.9 kB
          Grant Henke

        Activity

          People

            granthenke Grant Henke
            granthenke Grant Henke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: