Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Managing classpath (in general and with Subversion)
Managing classpath (in general and with Subversion) [message #676302] Fri, 03 June 2011 15:03 Go to next message
B Mayes is currently offline B MayesFriend
Messages: 7
Registered: June 2011
Junior Member
Hi,

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:

index.php/fa/2926/0/

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"?>
<classpath>
        <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:

index.php/fa/2927/0/

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?


Thanks!

[Updated on: Fri, 03 June 2011 15:07]

Report message to a moderator

Re: Managing classpath (in general and with Subversion) [message #676407 is a reply to message #676302] Sat, 04 June 2011 08:10 Go to previous messageGo to next message
Klaus S. is currently offline Klaus S.Friend
Messages: 11
Registered: January 2011
Junior Member
B Mayes wrote on Fri, 03 June 2011 11:03

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.


It seems to me as if you are using 2 different views, Project Explorer(windows system) and Package Explorer (linux)

B Mayes wrote on Fri, 03 June 2011 11:03

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?


Does it not? I'm using Eclipse Helios and jar files show up under their folder although they are referenced in the build path.
Re: Managing classpath (in general and with Subversion) [message #677588 is a reply to message #676407] Wed, 08 June 2011 21:41 Go to previous messageGo to next message
B Mayes is currently offline B MayesFriend
Messages: 7
Registered: June 2011
Junior Member
Ah yes...you are correct! There is a subtle difference between package explorer and project explorer. I opened the package explorer view on Windows and it shows up just fine. Thank you! I was wondering why my boss didn't have this problem on his system when he checked out the project from my system.

In regard to the libraries, it seems to show WEB-INF/lib when I first checkout the project. However, as soon as I right-click > build path > add external archives and then select the jar files from WEB-INF/lib, it actually hides the lib directory under WEB-INF (in package explorer) and shows it under referenced libraries instead. This is unfortunate because it no longer seems to show changes to the jar file with the little asterisk icon...unless of course you switch to the team synchronizing perspective. I'm using Helios as well.

Anyway, that's fine...we're actually making these changes in subversion tonight so that things will work natively with eclipse. I can live with the referenced libraries vs. WEB-INF/lib issue for now. Smile

On a somewhat related note, you can toggle referenced libraries by clicking the little down arrow near the top right of the package explorer view and selecting the option to show or not. Unfortunately unchecking this does not move the jars back to WEB-INF/lib but oh well.
Re: Managing classpath (in general and with Subversion) [message #678808 is a reply to message #677588] Thu, 09 June 2011 15:10 Go to previous message
B Mayes is currently offline B MayesFriend
Messages: 7
Registered: June 2011
Junior Member
Woo hoo! Changes in SVN were made and now the WEB-INF/lib vs. referenced libraries is no longer an issue. All is well in the world now. Smile
Previous Topic:Javadoc not showing in Android project
Next Topic:JasperWave - completely new Eclipse-based designer for JasperReports
Goto Forum:
  


Current Time: Tue Mar 19 05:09:08 GMT 2024

Powered by FUDForum. Page generated in 0.02210 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top