Project

Profile

Help

Bug #5801

closed

Dependency on axiom pom causes maven-dependency-plugin error

Added by Robin Meade almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
2023-01-07
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, 12, trunk
Fix Committed on Branch:
11, 12, trunk
Fixed in Maintenance Release:
Platforms:
Java

Description

I don't think the Saxon-HE-11.4 pom should specify this dependency:

<dependency>
  <groupId>org.apache.ws.commons.axiom</groupId>
  <artifactId>axiom</artifactId>
  <version>1.2.15</version>
  <optional>true</optional>
</dependency>

because it serves only as a parent pom. (It's packaging is pom, not jar.)

Alternatively, add <type>pom</type> if you really want this as a dependency, add pom`:

<dependency>
  <groupId>org.apache.ws.commons.axiom</groupId>
  <artifactId>axiom</artifactId>
  <version>1.2.15</version>
  <optional>true</optional>
  <type>pom</type>
</dependency>

The way it is now causes errors when I use a recent version of the Maven Dependency Plugin:

To see the problem, try this:

$ mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -Dartifact=net.sf.saxon:Saxon-HE:11.4
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:get (default-cli) @ standalone-pom ---
[INFO] Resolving net.sf.saxon:Saxon-HE:jar:11.4 with transitive dependencies
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.553 s
[INFO] Finished at: 2023-01-03T16:56:45-10:00
[INFO] ------------------------------------------------------------------------

The above invocation gave no error because, for some reason, the older version of the maven-dependency-plugin didn't attempt to download optional dependencies.

Now try a more recent version of the maven-dependency-plugin:

$ mvn org.apache.maven.plugins:maven-dependency-plugin:3.4.0:get -Dartifact=net.sf.saxon:Saxon-HE:11.4
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:3.4.0:get (default-cli) @ standalone-pom ---
[INFO] Resolving net.sf.saxon:Saxon-HE:jar:11.4 with transitive dependencies
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom/1.2.15/axiom-1.2.15.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom/1.2.15/axiom-1.2.15.pom (45 kB at 60 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-dom/1.2.15/axiom-dom-1.2.15.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-dom/1.2.15/axiom-dom-1.2.15.pom (5.3 kB at 36 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/implementations/1.2.15/implementations-1.2.15.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/implementations/1.2.15/implementations-1.2.15.pom (5.3 kB at 35 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-api/1.2.15/axiom-api-1.2.15.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-api/1.2.15/axiom-api-1.2.15.pom (16 kB at 107 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-impl/1.2.15/axiom-impl-1.2.15.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-impl/1.2.15/axiom-impl-1.2.15.pom (4.6 kB at 29 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom/1.2.15/axiom-1.2.15.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-dom/1.2.15/axiom-dom-1.2.15.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-api/1.2.15/axiom-api-1.2.15.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-impl/1.2.15/axiom-impl-1.2.15.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-impl/1.2.15/axiom-impl-1.2.15.jar (348 kB at 687 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-api/1.2.15/axiom-api-1.2.15.jar (421 kB at 811 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/ws/commons/axiom/axiom-dom/1.2.15/axiom-dom-1.2.15.jar (447 kB at 807 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.749 s
[INFO] Finished at: 2023-01-03T16:59:19-10:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.4.0:get (default-cli) on project standalone-pom: Couldn't download artifact: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact org.apache.ws.commons.axiom:axiom:jar:1.2.15 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

The error message shows that it is trying to download a .jar file for

   org.apache.ws.commons.axiom:axiom:jar:1.2.15

which doesn't make sense because the referenced dependency isn't a jar artifact; it is a pom artificat.

Another good test is this:

cd "$(mktemp -d)"
curl -OJ https://repo.maven.apache.org/maven2/net/sf/saxon/Saxon-HE/11.4/Saxon-HE-11.4.pom
mvn -f Saxon-HE-11.4.pom org.apache.maven.plugins:maven-dependency-plugin:2.8:resolve
mvn -f Saxon-HE-11.4.pom org.apache.maven.plugins:maven-dependency-plugin:3.4.0:resolve

Both of the above mvn invocations fail with error about:

Could not find artifact org.apache.ws.commons.axiom:axiom:jar:1.2.15 
in central (https://repo.maven.apache.org/maven2

Update: I see you use Gradle. I'm not sure how type maps to Gradle concepts. Maybe adding @pom.

Please register to edit this issue

Also available in: Atom PDF