Re: Any idea how to determine all the JAR dependencies a give JAR has?

Peter Donald <peter-4lf8KW9E9MLMqX/[email protected]> Fri, 19 Dec 2003 13:34:34 +1100
Newsgroups gmane.comp.java.jcontainer.interest
Message-ID <[email protected]>
Hi,

A while back I was working on some stuff that would have been useful here with 
the aims of proposing it to the maven crew. I ran out of time with xmas but 
plan to go back to it in new year. 

Essentially every jar would have a file META-INF/maven/artifact.xml that 
looked something like dependencies secion in project.xml like

<artifact>
  <id>spice-threadpool</id>
  <groupId>spice</groupId>
  <version>1.0</version>

  <dependencies>
    <dependency>
      <id>commons-pool</id>
      <groupId>commons-pool</groupId>
      <version>2.0</version>
    </dependency>
    <dependency>
      <id>oro</id>
      <groupId>oro</groupId>
      <version>1.4.3</version>
    </dependency>
  </dependencies>
</artifact>

Anyhow - these would be recursively scanned to build final classpath.

The reason I did not go with POM was because it carreid lots of information 
not needed and it also could be result of inheritance and unless you somehow 
merge in project inherited from you have an invalid project descriptor. It 
also added lots more complexity with property interpolation etc. 

However to make it easier I just built this descriptor from the project.xml 
omitting any non-jar dependencies and any dependencies that had 
<artifact.include>false</artifact.include> etc.

-- 
Cheers,

Peter Donald
God is Dead -- Nietzsche
Nietzsche is Dead -- God
Nietzsche is God -- The Dead