glassfish
  1. glassfish
  2. GLASSFISH-17170

Issues while adding dependency on nucleus or other such distributions in maven

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.1
    • Fix Version/s: 3.1.2_b18
    • Component/s: packaging
    • Labels:
      None

      Description

      See the errors below which show that we have something wrong in our maven pom of nucleus which is forcing maven to look for distribution fragment type artifacts instead of zip artifacts for the missing ones below. To reproduce, just create a sample pom with dependency like this:

      <dependency>
      <groupId>org.glassfish.distributions</groupId>
      <artifactId>nucleus</artifactId>
      <version>3.1.1</version>
      <type>zip</type>
      <scope>test</scope>
      </dependency>

      Downloading: http://repo1.maven.org/maven2/org/glassfish/osgi-platforms/equinox/3.1.1/equinox-3.1.1.distribution-fragment
      [INFO] Unable to find resource 'org.glassfish.osgi-platforms:equinox:distribution-fragment:3.1.1' in repository central (http://repo1.maven.org/maven2)
      6260K downloaded (nucleus-3.1.1.zip)
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Failed to resolve artifact.

      Missing:
      ----------
      1) org.glassfish.osgi-platforms:felix:distribution-fragment:3.1.1

      Try downloading the file manually from the project website.

      Then, install it using the command:
      mvn install:install-file -DgroupId=org.glassfish.osgi-platforms -DartifactId=felix -Dversion=3.1.1 -Dpackaging=distribution-fragment -Dfile=/path/to/file

      Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.glassfish.osgi-platforms -DartifactId=felix -Dversion=3.1.1 -Dpackaging=distribution-fragment -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

      Path to dependency:
      1) org.glassfish.fighterfish:test.it:jar:1.0.0-SNAPSHOT
      2) org.glassfish.distributions:nucleus:zip:3.1.1
      3) org.glassfish.packager:felix:zip:3.1.1
      4) org.glassfish.osgi-platforms:felix:distribution-fragment:3.1.1

      2) org.glassfish.docs:basedocs:distribution-fragment:3.2-b03

      Try downloading the file manually from the project website.

      Then, install it using the command:
      mvn install:install-file -DgroupId=org.glassfish.docs -DartifactId=basedocs -Dversion=3.2-b03 -Dpackaging=distribution-fragment -Dfile=/path/to/file

      Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.glassfish.docs -DartifactId=basedocs -Dversion=3.2-b03 -Dpackaging=distribution-fragment -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

      Path to dependency:
      1) org.glassfish.fighterfish:test.it:jar:1.0.0-SNAPSHOT
      2) org.glassfish.distributions:nucleus:zip:3.1.1
      3) org.glassfish.packager:glassfish-nucleus:zip:3.1.1
      4) org.glassfish.docs:basedocs:distribution-fragment:3.2-b03

      3) org.glassfish.registration:servicetag-registry:distribution-fragment:3.1.1

      Try downloading the file manually from the project website.

      Then, install it using the command:
      mvn install:install-file -DgroupId=org.glassfish.registration -DartifactId=servicetag-registry -Dversion=3.1.1 -Dpackaging=distribution-fragment -Dfile=/path/to/file

      Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.glassfish.registration -DartifactId=servicetag-registry -Dversion=3.1.1 -Dpackaging=distribution-fragment -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

      Path to dependency:
      1) org.glassfish.fighterfish:test.it:jar:1.0.0-SNAPSHOT
      2) org.glassfish.distributions:nucleus:zip:3.1.1
      3) org.glassfish.registration:servicetag-registry:distribution-fragment:3.1.1

      4) org.glassfish.osgi-platforms:equinox:distribution-fragment:3.1.1

      Try downloading the file manually from the project website.

      Then, install it using the command:
      mvn install:install-file -DgroupId=org.glassfish.osgi-platforms -DartifactId=equinox -Dversion=3.1.1 -Dpackaging=distribution-fragment -Dfile=/path/to/file

      Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.glassfish.osgi-platforms -DartifactId=equinox -Dversion=3.1.1 -Dpackaging=distribution-fragment -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

      Path to dependency:
      1) org.glassfish.fighterfish:test.it:jar:1.0.0-SNAPSHOT
      2) org.glassfish.distributions:nucleus:zip:3.1.1
      3) org.glassfish.packager:glassfish-nucleus:zip:3.1.1
      4) org.glassfish.osgi-platforms:equinox:distribution-fragment:3.1.1

      ----------
      4 required artifacts are missing.

      for artifact:
      org.glassfish.fighterfish:test.it:jar:1.0.0-SNAPSHOT

      from the specified remote repositories:
      glassfish-repo-archive (http://maven.glassfish.org/content/groups/glassfish),
      central (http://repo1.maven.org/maven2),
      glassfish-nexus-repo (http://maven.glassfish.org/content/groups/glassfish)

        Activity

        Hide
        Sanjeeb Sahoo added a comment -

        The workaround is to add some exclusion clauses like this:

        <dependency>
        <groupId>org.glassfish.distributions</groupId>
        <artifactId>nucleus</artifactId>
        <version>3.1.1</version>
        <type>zip</type>
        <optional>true</optional>
        <scope>test</scope>
        <exclusions>
        <exclusion>
        <groupId>org.glassfish.docs</groupId>
        <artifactId>basedocs</artifactId>
        </exclusion>
        <exclusion>
        <groupId>org.glassfish.registration</groupId>
        <artifactId>servicetag-registry</artifactId>
        </exclusion>
        <exclusion>
        <groupId>org.glassfish.osgi-platforms</groupId>
        <artifactId>felix</artifactId>
        </exclusion>
        <exclusion>
        <groupId>org.glassfish.osgi-platforms</groupId>
        <artifactId>equinox</artifactId>
        </exclusion>
        </dependency>

        Show
        Sanjeeb Sahoo added a comment - The workaround is to add some exclusion clauses like this: <dependency> <groupId>org.glassfish.distributions</groupId> <artifactId>nucleus</artifactId> <version>3.1.1</version> <type>zip</type> <optional>true</optional> <scope>test</scope> <exclusions> <exclusion> <groupId>org.glassfish.docs</groupId> <artifactId>basedocs</artifactId> </exclusion> <exclusion> <groupId>org.glassfish.registration</groupId> <artifactId>servicetag-registry</artifactId> </exclusion> <exclusion> <groupId>org.glassfish.osgi-platforms</groupId> <artifactId>felix</artifactId> </exclusion> <exclusion> <groupId>org.glassfish.osgi-platforms</groupId> <artifactId>equinox</artifactId> </exclusion> </dependency>
        Hide
        Snjezana Sevo-Zenzerovic added a comment -

        What maven version is being used?

        Show
        Snjezana Sevo-Zenzerovic added a comment - What maven version is being used?
        Hide
        Sanjeeb Sahoo added a comment -

        maven version is 2.2.1

        Show
        Sanjeeb Sahoo added a comment - maven version is 2.2.1
        Hide
        janey added a comment -

        "distribution-fragment" is a customized Maven type defined in maven-glassfishbuild-extension. So you need to add maven-glassfishbuild-extension in the pom:
        <build>
        <extensions>
        <extension>
        <groupId>org.glassfish.build</groupId>
        <artifactId>maven-glassfishbuild-extension</artifactId>
        <version>3.1.1</version>
        </extension>
        </extensions>
        </build>
        Remove the exclusion clauses and add the above extension and build again. This should work.

        However, org.glassfish.distributions:nucleus artifact should really be a zip artifact. All dependencies in nucleus' pom should be defined optional.

        Show
        janey added a comment - "distribution-fragment" is a customized Maven type defined in maven-glassfishbuild-extension. So you need to add maven-glassfishbuild-extension in the pom: <build> <extensions> <extension> <groupId>org.glassfish.build</groupId> <artifactId>maven-glassfishbuild-extension</artifactId> <version>3.1.1</version> </extension> </extensions> </build> Remove the exclusion clauses and add the above extension and build again. This should work. However, org.glassfish.distributions:nucleus artifact should really be a zip artifact. All dependencies in nucleus' pom should be defined optional.
        Hide
        Sanjeeb Sahoo added a comment -

        Let me understand your comment Jane. Are you asking me to add glassfish-build plugin as an extension in order to be successfully use nucleus as a dependency? That sounds weired. How will anyone know such a requirement? I already specified the type as zip for nucleus dependency. Something is not correct here. It could be a bug in maven as well if such a configuration is needed.

        Show
        Sanjeeb Sahoo added a comment - Let me understand your comment Jane. Are you asking me to add glassfish-build plugin as an extension in order to be successfully use nucleus as a dependency? That sounds weired. How will anyone know such a requirement? I already specified the type as zip for nucleus dependency. Something is not correct here. It could be a bug in maven as well if such a configuration is needed.
        Hide
        janey added a comment -

        Yes, you need to add maven-glassfishbuild-extension for Maven to know about the distribution-fragment packaging. I agree this is weird to ask user to defined it as a requirement so IMO, this is a bug in GF distribution nucleus pom. Users depending on nucleus zip artifact do not need to know about "distribution-fragment". This packaging type is used by GF packager via maven-antrun-extended-plugin to separate where modules are staged. To fix this bug, we need to define the dependencies in nucleus pom as optional.

        Show
        janey added a comment - Yes, you need to add maven-glassfishbuild-extension for Maven to know about the distribution-fragment packaging. I agree this is weird to ask user to defined it as a requirement so IMO, this is a bug in GF distribution nucleus pom. Users depending on nucleus zip artifact do not need to know about "distribution-fragment". This packaging type is used by GF packager via maven-antrun-extended-plugin to separate where modules are staged. To fix this bug, we need to define the dependencies in nucleus pom as optional.
        Hide
        Sanjeeb Sahoo added a comment -

        Marking all the dependencies optional fixes the issue. I have made the necessary changes in trunk in following commits. I request build/packaging team to do the needful in 3.1.2.
        trunk:
        svn rev #51843
        trunk/main/appserver/distributions/glassfish/pom.xml
        trunk/main/appserver/distributions/minnow/pom.xml
        trunk/main/nucleus/distributions/nucleus/pom.xml
        trunk/main/appserver/distributions/web/pom.xml
        trunk/main/appserver/distributions/nucleus/pom.xml
        trunk/main/nucleus/distributions/atomic/pom.xml

        svn rev#51845
        trunk/main/appserver/distributions/minnow/pom.xml

        Show
        Sanjeeb Sahoo added a comment - Marking all the dependencies optional fixes the issue. I have made the necessary changes in trunk in following commits. I request build/packaging team to do the needful in 3.1.2. trunk: svn rev #51843 trunk/main/appserver/distributions/glassfish/pom.xml trunk/main/appserver/distributions/minnow/pom.xml trunk/main/nucleus/distributions/nucleus/pom.xml trunk/main/appserver/distributions/web/pom.xml trunk/main/appserver/distributions/nucleus/pom.xml trunk/main/nucleus/distributions/atomic/pom.xml svn rev#51845 trunk/main/appserver/distributions/minnow/pom.xml
        Hide
        janey added a comment -

        Fixed in 3.1.2 workspace.

        Sending distributions/glassfish/pom.xml
        Sending distributions/minnow/pom.xml
        Sending distributions/nucleus/pom.xml
        Sending distributions/web/pom.xml
        Transmitting file data ....
        Committed revision 52120.

        Show
        janey added a comment - Fixed in 3.1.2 workspace. Sending distributions/glassfish/pom.xml Sending distributions/minnow/pom.xml Sending distributions/nucleus/pom.xml Sending distributions/web/pom.xml Transmitting file data .... Committed revision 52120.

          People

          • Assignee:
            janey
            Reporter:
            Sanjeeb Sahoo
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: