1

I'm trying to get every single dependency for the artifact axis:axis:1.4 using Maven, but to little success. Here's what I've done:

The POM:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany</groupId>
  <artifactId>myapp</artifactId>
  <version>1</version>

  <dependencies>
      <dependency>
        <groupId>axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
      </dependency>
  </dependencies>
</project>

The Batch Script to build the dependency graph:

@echo off
set PATH=%PATH%;D:\tools\apache-maven-3.6.0\bin
set JAVA_HOME=C:\Program Files (x86)\Java\jre1.8.0_171
call mvn compile dependency:tree -DoutputType=dot -DoutputFile=dependencies.txt
pause

The result:

digraph "com.mycompany:myapp:jar:1" { 
    "com.mycompany:myapp:jar:1" -> "axis:axis:jar:1.4:compile" ; 
    "axis:axis:jar:1.4:compile" -> "org.apache.axis:axis-jaxrpc:jar:1.4:compile" ; 
    "axis:axis:jar:1.4:compile" -> "org.apache.axis:axis-saaj:jar:1.4:compile" ; 
    "axis:axis:jar:1.4:compile" -> "axis:axis-wsdl4j:jar:1.5.1:runtime" ; 
    "axis:axis:jar:1.4:compile" -> "commons-logging:commons-logging:jar:1.0.4:runtime" ; 
    "axis:axis:jar:1.4:compile" -> "commons-discovery:commons-discovery:jar:0.2:runtime" ; 
 } 

At first glance, this seems reasonable. However, a quick search for the commons-logging:commons-logging:1.0.4 artifact reveals that there are more dependencies to be found. The aforementioned commons-logging library depends on:

  • log4j:log4j:1.2.6
  • logkit:logkit:1.0.1
  • avalon-framework:avalon-framework:4.1.3

...yet none of these dependencies (and their dependencies) are found in the generated dependency graph.

My question is, thus, as follows: is there a way to get the aforementioned dependencies (and their dependencies, and their dependencies' dependencies, and so forth...) to show up in the graph? And if so, how?

  • Possible duplicate of [List of dependency jar files in Maven](https://stackoverflow.com/questions/278596/list-of-dependency-jar-files-in-maven) – Raedwald Nov 29 '18 at 10:57

1 Answers1

0

dependency:tree gives you the complete list of dependencies. The mentioned artifacts

  • log4j:log4j:1.2.6
  • logkit:logkit:1.0.1
  • avalon-framework:avalon-framework:4.1.3

are dependencies with <optional>true</optional>. These are not drawn as transitive dependencies so they are not included into the dependency tree.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • I see. Is there any way I can force `dependency:tree` to include these optional dependencies? – Miguel Lopes Martins Nov 29 '18 at 13:10
  • I don't know. What do you want to find out? What is your ultimate goal? – J Fabian Meier Nov 29 '18 at 13:27
  • My ultimate goal is to import axis-1.4.jar and all of its dependencies into Oracle 11g so that I may consume webservices using the Axis runtime. – Miguel Lopes Martins Nov 29 '18 at 13:33
  • That sounds a bit strange. Why manage dependencies in a database? By the way: Optional dependencies are declared this way because they are not necessary in every use case. This means you usually look into the docs and figure out which of the optional dependencies you really need. – J Fabian Meier Nov 29 '18 at 13:55
  • Oracle 11g's `loadjava` tool seems to be a bit picky when it comes to importing JAR files to be used as libraries; if there's an unsatisfied dependency, it will throw an error, even if said dependency is, as far as Maven is concerned, optional. Not sure why that is... From what I understand, perhaps this problem is best solved in an entirely different way. In fact, we managed to solve it by adding the required JARs to Oracle's JDK's CLASSPATH. Another way to do it would be, perhaps, by invoking the necessary webservice(s) via PL/SQL. – Miguel Lopes Martins Nov 29 '18 at 14:16
  • Are you sure that loadjava scans Maven dependencies? Do you get a runtime error or a compile time problem? – J Fabian Meier Nov 30 '18 at 09:01
  • loadjava does not scan Maven dependencies. Perhaps I didn't make myself clear on that part. What I get is a resolution error when, say, importing the commons-logging-1.0.4.jar, who in turn complains about a missing **org/apache/log4j/Logger** (which belongs to log4j), **org/apache/log/Logger** (belongs to logkit), and **org/apache/avalon/framework/logger/Logger** (belongs to avalon-framework). Again, loadjava does **not** work with Maven, but it **does** need every single dependency in order to avoid resolution errors, hence why this question was born. – Miguel Lopes Martins Nov 30 '18 at 09:25