|Managing classpath (in general and with Subversion) [message #676302]
||Fri, 03 June 2011 15:03
| B Mayes
Registered: June 2011
I am running into a few issues when adding jars to the classpath. We use Subversion as our code repository, and I'm the first developer that uses Eclipse (every one else uses IntelliJ). My boss is very interested in moving things to Eclipse so I dumped our SVN repo and got things running on my local machine. I then tweaked some files and setup build.xml such that everything works in an automated fashion for Eclipse now. You simply checkout the project in Eclipse (I'm using the Subclipse plugin) and then run build.xml. If your workspace is tomcat/webapps then after running build.xml the application is instantly available and ready to go. This all works great.
What doesn't work so great is the presentation of the libraries in the classpath. In Subversion we store our jar files in the WEB-INF/lib directory (which is where Tomcat's class loader looks for them). So what I did was to modify the .classpath file on my system so that all of the libraries are appropriately referenced (most are in WEB-INF/lib, but a few should go into ../../lib which is tomcat/lib). In this way, Eclipse can automatically build the project and NO ERRORS will be shown in the .java files.
Here are the problems I have with the classpath however:
- If you checkout the project on a Windows machine (which everyone else uses) then the project works and can be built, but all of the jar files show up as children of the main project directory like this:
Thus, in order to move from the src directory (where the .java files are stored) to get to other files (.jsp, .js, images, etc.) you have to scroll past all of the jar files in the classpath. I have tried deleting the project and checking out again, refreshing, closing/opening the project but nothing seems to work. The .classpath file references them correctly as lib resources like so:
<?xml version="1.0" encoding="UTF-8"?>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="WEB-INF/lib/activation.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/arcgis_agsws_stubs.jar"/>
- If you checkout the project in Linux (or add the jar files to the classpath manually on any platform) then Eclipse places the jar files under the "Referenced Libraries" section of the project like this:
This is certainly much better than the behavior described above but I still don't like it because it winds up removing the WEB-INF/lib directory from the "Package Explorer" view. Subclipse doesn't seem to play nicely with this, and if you change a jar file you no longer see the little asterisk on the jar file name showing that it is modified. Instead, you have to switch to the "Team Synchronizing" perspective and synchronize with the repository.
So my questions are:
1. Is there any way to fix the way that Eclipse on Windows displays the jar files when the project is checked out? At a minimum, I need to get the jar files to be displayed under the Referenced Libraries section instead of showing up as children of the main project node.
2. Is there any way to 'ignore' the Referenced Libraries node such that all of the jars (or at least the ones coming from WEB-INF/lib) show up under WEB-INF/lib instead of Referenced Libraries?
[Updated on: Fri, 03 June 2011 15:07]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02094 seconds