1 Reply Latest reply on Nov 26, 2015 9:27 AM by sverker.sverker.abrahamsson.com

    Shrinkwrap maven respolver fails if pom has namespace?

    sverker.sverker.abrahamsson.com

      I am trying to add a library to my shrinkwrap deployment using the Maven resolver, but if the pom.xml is defined with a namespace (<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">) then I get the following error:

       

      Caused by: java.lang.IllegalArgumentException: Bad artifact coordinates ::jar:, expected format is <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>

       

      The reason is that the xpath, e.g. /project/artifactId, returns empty as it doesn't match the namespace. If I remove the namespace in my pom then it works but fails later when it hits another pom with namespace due to the transitivity.

       

      The specific part of the code where I use the resolver look like this:

      Maven.configureResolver()

           .loadPomFromFile("pom.xml")

           .resolve("org.mockftpserver:MockFtpServer:2.6")

           .withTransitivity()

           .as(JavaArchive.class);

       

      It does seem odd that the namespace makes it fail, so I wounder what I am missing?