How can i attach the source in eclipse using java program? Can anyone help me??? Thanks in advance..
Attached sources are stored in the .classpath
file in the project root directory, which you can manipulate programmatically. Entries look like this:
<classpathentry kind="lib" path="lib/joda-time-1.6.jar"
sourcepath="/lib/joda-time-1.6-sources.jar"/>
If you want automatically attached sources, you will probably want to use maven as a system for build and dependency management. It is the only system I know that supports this feature out of the box.
The integration with eclipse is great through either the m2eclipse eclipse plugin or the maven-eclipse-plugin on the maven side. Either way: when a jar mylib-1.2.3.jar
is downloaded, maven will automatically look for a jar called mylib-1.2.3-sources.jar
and attach it if present (and it is present for most open source projects). It really makes life a lot easier.
精彩评论