I've written an ant task that extracts the classpath of a project form eclipse's .classpath file - so I don't need to maintain the project's dependencies both in eclipse and in my ant file.
This ant task works great and it makes my compilation ant scripts to be very elegant, short, and the most important thing maintainable.
In Eclipse you can use a pre-defined Libraries (under project > Properties > Java Build Path > Libraries), 开发者_运维问答for example: Junit, Apache Tomcat, and JRE System Library. I am not talking about a user library
Each library hold a list of jars associated with it. I can see this list by expanding the library. Foe example the Juni4 library contains 2 jars: junit.jar
What keeps me from finalizing my work is that I don't know where eclipse stores the information about the jars inside the library.
-- Yonatan
Maybe in bundles.info
(the following paths are from the Helios3.6 distribution, but you can find similar paths with Galileo 3.5)
C:\Prog\Java\eclipse-SDK-3.6-win32-x86_64\eclipse\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info
, where you can read:
org.eclipse.jdt.junit4.runtime,1.1.100.v20100526-0800,plugins/org.eclipse.jdt.junit4.runtime_1.1.100.v20100526-0800.jar,4,false
which references the junit.jar found in:
C:\Prog\Java\eclipse-SDK-3.6-win32-x86_64\eclipse\plugins\org.junit_4.8.1.v4_8_1_v20100427-1100\
That is consistent which what you cansee when you actually "add a Library":
alt text http://img805.imageshack.us/img805/4581/eclipseaddlib.png
精彩评论