3 Replies Latest reply on Oct 24, 2013 9:15 AM by Karel Piwko

    PackagingType of MavenCoordinates always has JAR value

    Xavi Arias Newbie
      When using PomEquippedResolveStage to resolve Maven dependencies as MavenResolvedArtifacts, the PackagingType of MavenCoordinates have always JAR value, ignoring the POM's <packaging> element for EJB modules.

       

      Is this the expected behavior? This issue blocks me to build a EAR using ShrinkWrap since EJB modules have to be added to EARs using EnterpriseArchive.addAsModule() and not addAsLibrary(). This could be solved if the packaging type was set to whatever is set in the POM file of each dependency.

       

      Here is a sample code to reproduce the issue:

       

          String userHome = System.getProperty("user.home");

          String settingsXml = userHome + "/.m2/settings.xml";

       

          PomEquippedResolveStage rs = Maven.configureResolver()

              .fromFile(settingsXml).offline().loadPomFromFile("pom.xml");

       

          MavenStrategyStage mavenStrategyStage = rs.resolve("groupId:artifactId");

          MavenFormatStage mavenFormatStage = mavenStrategyStage.withTransitivity();


          for (MavenResolvedArtifact resolvedArtifact : mavenFormatStage.asResolvedArtifact()) {

            System.out.println(resolvedArtifact.getCoordinate().getPackaging());

          }

       

      The version I am using of ShrinkWrap Resolver is 2.0.0.