I want to be able to get a list of all classes that an artifact depends on. The maven-dependency-plugin
goal list-classes
with parameter transitive
set to true does exactly what I need. Except there is an issue when there is a dependency on an artifact with type tar.gz
Let’s say I have a dependency tree that looks like this:
org.test:parent:jar:SNAPSHOT
+- org.test:A:jar:SNAPSHOT
| +- org.test:B:jar:SNAPSHOT
| - org.test:B:tar.gz:SNAPSHOT
+- org.test:C:jar:SNAPSHOT
If I run mvn dependency:list-classes -DgroupId=org.test -DartifactId=parent -Dversion=SNAPSHOT -Dtransitive=true
, there is an error “Couldn’t download artifact: error in opening zip file”. I took a look at the source code (https://github.com/apache/maven-dependency-plugin/blob/master/src/main/java/org/apache/maven/plugins/dependency/ListClassesMojo.java) and it seems to only accept artifacts of type jar.
Is there a workaround to alter the transitive dependencies to exclude artifacts of certain types?
1