Include multiple jars with classpathentry
Solution 1
I'm not sure eclipse can do that itself.
You could try
- Move to Maven for you build system and then it's eclipse:eclipse command will generate the .classpath file for you
- Get ant to modify the .classpath after a build. After all, it's just xml
Solution 2
My colleague implemented a classpath container which recursivly looks for jars in a given directory within the workspace, have a look at http://openscada.org/2010/05/31/adding-a-directory-as-class-path-to-eclipse/
The update site can be found at http://repo.openscada.org/p2/bob/R
The plugin is licensed unter LGPL V3 and you can find the source code under git://git.openscada.org/ (http://git.openscada.org/?p=org.openscada.bob.git;a=tree)
Solution 3
Eclipse does not work that way I'm afraid. The best solution I can think of is to generate the .classpath
file from script which scans the directory for jars.
Solution 4
There's a developerworks article that show how to implement a custom classpath container that exposes the contents of a directory. You'll need to register to view the article and download the sources.
Solution 5
IVY contains an ANT task that will create an XML file listing the location of the jar dependencies that it manages.
http://ant.apache.org/ivy/history/latest-milestone/use/artifactreport.html
It would be very straight forward to combine this with an XSLT stylesheet to afterwards generate the Eclipse .classpath file.
Comments
-
ripper234 almost 2 years
I have an eclipse's .classpath file that looks like this:
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="test"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> <classpathentry kind="lib" path="/libraries/jee/servlet-api.jar"/> <classpathentry kind="lib" path="/libraries/junit/junit-4.6.jar"/> <classpathentry kind="lib" path="/libraries/log4j/log4j-1.2.15.jar"/> </classpath>
I'd like to add a whole directory of jars to the classpath - I like eclipse (or more precisely, our ant-based build process that uses .classpath format) to know several jars that reside in a single directory, without specifying them directly. How can I do that?
-
ripper234 almost 15 yearsIt's a tactical problem - if there existed a built-in option, I'd have used it. For now, I'll just list all the jars manually. Thanks