Bug 22123 - Inability to put a classpath var pointing to a dir inside the project which is one dir up from output dir
Summary: Inability to put a classpath var pointing to a dir inside the project which i...
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-02 10:35 EDT by Nicolaus Bauman CLA
Modified: 2002-09-10 08:51 EDT (History)
0 users

See Also:


Attachments
.classpath file as requested (2.15 KB, text/xml)
2002-08-27 22:01 EDT, Nicolaus Bauman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolaus Bauman CLA 2002-08-02 10:35:11 EDT
When we try to assign a classpath variable assigned to dir inside project one 
dir up from output (classes) dir, we find this breaks search and refactoring 
tools. Furthermore, while we were able to do this in Eclipse 1.0, Eclipse 2.0 
doesn't allow for us to do this through the UI.

We are, however, able to manually add the classpath variable to the .classpath 
file and Eclipse 2.o will use that.
Comment 1 Philipe Mulet CLA 2002-08-06 09:42:41 EDT
Can you provide exact steps to reproduce ?
Comment 2 Nicolaus Bauman CLA 2002-08-06 10:44:33 EDT
Exact steps to reproduce:

1) Place a servlet engine inside the project directory containing a web root 
directory containing an unpacked WAR

2) Deploy and Configure Struts MVC framework in said WAR

3) Add the top level of the WAR to the Eclipse classpath as a Classpath 
Variable. The reason we need to do this is so that StrutsTest.jar (Struts' 
JUnit base test package) can find the struts-config.xml in the classpath, which 
is placed in <WAR>/WEB-INF). Note, you cannot add such a variable through the 
Eclipse UI in Eclipse 2.0. You must edit the ".classpath" file manually. 
Eclipse 1.0 allowed you to do this.

Now everything compiles fine and runs fine, however search will no longer work 
(always returns without finding anything) and refactoring tools no longer work 
(will fail to do anything)
Comment 3 Philipe Mulet CLA 2002-08-09 09:22:42 EDT
Smells like a search/model bug only.
Comment 4 Jerome Lanneluc CLA 2002-08-23 10:54:27 EDT
I created a Java project P with the following .classpath file:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" 
sourcepath="JRE_SRC"/>
    <classpathentry kind="var" path="TEST"/>
    <classpathentry kind="output" path="a\bin"/>
</classpath>

and the variable TEST resolving to 'P/a' and I was able to search in this 
project.

Could you please post your .classpath file?
Comment 5 Nicolaus Bauman CLA 2002-08-27 22:01:45 EDT
Created attachment 1905 [details]
.classpath file as requested
Comment 6 Nicolaus Bauman CLA 2002-08-27 22:03:54 EDT
Were you able to _successfully_ search and find anything? Note: the searching 
sometimes works for a while with the classpath variable. It seems to die after 
a big compile happens or when eclipse is shut down and reopened again.
Comment 7 Jerome Lanneluc CLA 2002-08-28 08:20:14 EDT
Yes I was able to search and find results.

Note your setup is not officially supported (you're not supposed to edit 
the .classpath as this could break the conventions used in JDT, see 
JavaConventions.validateClasspath).

However, if you provide a small self-contained test case (i.e. without refering 
to Tomcat), I can try to see what is going on.

BTW do you have anything in your <workspace>/.metadata/.log file?
Comment 8 Nicolaus Bauman CLA 2002-08-28 11:13:34 EDT
I can't give you a log output, I'm so very sorry, as we have discovered a 
workaround and have since rewritten the log serveral times :\

The workaround should help. We placed the struts-config.xml into the src/ 
directory and changed the MockStrutsTestCase child class to set the config file 
to that resource in the classpath. We then edited the web.xml file to point to 
the struts-config in the classes/ directory where eclipse outputs. This works 
for us now, as refactoring now works again and searching works without 
resorting to using a classpath variable, yea!!

While I fully understand the issue of hand editing the .classpath file, you 
might consider people upgrading from earlier versions of Eclipse who were able 
to declare the classpath variable in the IDE and were no longer able to in 
subsequent versions.


Comment 9 Jerome Lanneluc CLA 2002-08-28 11:27:32 EDT
It is always hard to be bug backward compatible :-)

Since no one else has complained, and you have a workaround, is it OK to close 
this bug?
Comment 10 Nicolaus Bauman CLA 2002-08-28 14:56:52 EDT
Doh! You're right! :-)

I think it's OK to close the bug, but it begs the question as to why what 
amounts to a directory entry in the classpath should break these other tools?

I mean why should a classpath that looks like this:

-classpath /this/whatever.jar:/that/whazzit.jar

work and a classpath that looks like this:

-classpath /this/whatever.jar:/that/whazzit.jar:/my/fine/path/to/a/directory

break?

I'll try and create a contrived example that illustrates the behavior.
Comment 11 Jerome Lanneluc CLA 2002-08-29 05:40:56 EDT
I think in your case the probleme is that the output folder is nested 
inside /my/fine/path/to/a/directory. This confuses the underlying Java Model 
which assumes that the contents of a library on the classpath will never change 
(and the output directory changes with each build).

Closing