Bug 3777 - Adding a project to the build path adds it last (1GET2CB)
Summary: Adding a project to the build path adds it last (1GET2CB)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: All Linux
: P4 major (vote)
Target Milestone: ---   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 23:00 EDT by Tod Creasey CLA
Modified: 2002-01-17 10:12 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2001-10-10 23:00:42 EDT
If you add a project to the build path of another project it gets added after the source folder 
which will generally result in a pile of compilation errors.

STEPS
	1) Create a project Proj1
	2) Create another one Proj2
	3) Create a class in each project
	4) Write code in Proj2 that references the class in Proj1
	5) Add Proj1 to the build class for Proj2 - it is added after the source for Proj2 resulting
		in compilation errors


NOTES:

JW (6/4/01 12:11:41 PM)
	This ordering does not cause a problem normally - in fact, libraries after source is almost always the correct ordering
	(only risk is if same class is defined in two projects - in this case, there is no good resolution).

JW (6/4/01 12:13:22 PM)
	I could not reproduce this PR defining a class test1.Class1 in Proj1 and test2.Class2 in Proj2.
	Need better test case.

EG (6/4/2001 11:57:13 AM)
	I can't reproduce it either, need more info.

GDA (6/5/01 9:40:20 AM)
	Unless additional information is received, this PR will be closed.
	Pinged tod.

TC (6/5/01 10:59:41 AM) - this simple case worked Ok for me as well - I was attempting a simpler
case then what I had before.

I got this one self hosting trying to have source for swt and ui in my workbench.

I extracted the Eclipse install to two directories dev and target

I started dev with the argument -platform /viper/team/tod/118/target/eclipse/plugins

I created two JavaProjects with the default values - org.eclipse.ui and org.eclipse.swt.

Add the following libraries to the build path of org.eclipse.ui
	xerces.jar
	resources.jar
	boot.jar
	help.jar
	runtime.jar

Import the contents of workbenchsrc.jar into org.eclipse.ui and swtsrc.jar in org.eclipse.swt.

Delete workbench.jar from org.eclipse.ui and swt.jar from org.eclipse.swt

Add org.eclipse.swt to the build path of org.eclipse.ui

GDA (6/5/01 11:30:37 AM)
	Moving to candidates to be looked at more closely - there is something odd going on

JW (6/5/01 5:44:56 PM) Should investigate.

DM (6/6/01 5:18:48 PM)
	Investigating against 0.119...
	==>
	It adds Proj2 after the source folder of Proj and this correct, but it
	seems that the classpath order is not respected (tested with auto-build on
	and auto-build off / Rebuild All):
		Setup:
			1. Start empty Eclipse
			2. Add Java project Proj1
			3. Add Java project Proj2
			4. Add class A to Proj1 (default pkg) with:
				public A() {System.out.println("Proj1");}
			5. Add class A to Proj2 (default pkg) with:
				public A() {System.out.println("Proj2");}
			6. Add class B to Proj2 (default pkg) with:
				public static void main(String[] args) {new A();}
			7. Add Proj1 to the build path of Proj2

	==> you will see that Proj2 will be the output independent of the
			build path order unless you delete Proj2.A
		Having class A in the default package of both, Proj1 and Proj2
		and then having class B using A, it does not respect the ordering of
		the build path - it always uses A form Proj2 unless I rename Proj2.A.

	Tests using source folders and using non-default package gave the same results.

	There are two problems here:
	1) While the compiler can work with the granularity of source folders (and hence
		their ordering), the launcher can't: it "simply" adds the output folder of the
		project to the Java classpath.
	2) Using the default setup with project as output and (only) source folder does also
		not work because the output folder of the project is always put first on the class
		path without looking at the build order.

	As a long term fix we would suggest to add ordering feature to the source folder
	page and reduce the granularity on the build path page to projects and libraries.

	Since the default setup is to have proj=src folder=output folder, it would be good
	to respect the build path in that scenario, i.e. the classpath should have the output
	folders in the sequence listed on the build order page (as long as the project
	does not use source folders - if it does, then put its output folder first - ignoring
	the build path ordering).

EG (6/6/2001 12:24:17 PM)
	cannot fix README
Comment 1 Martin Aeschlimann CLA 2001-10-16 11:14:05 EDT
moved to 'active'
Comment 2 DJ Houghton CLA 2001-10-24 07:19:56 EDT
PRODUCT VERSION: 118


Comment 3 Erich Gamma CLA 2001-11-10 16:23:42 EST
Martin pls verify whether the problem at the bottom with regard to class path 
ordering still exists
Comment 4 Martin Aeschlimann CLA 2001-11-20 09:21:25 EST
in the latest change, the laucnch class path adds the outputfolder only when 
there is a source folder, and at the location of the first source folder.

DM's example in now working as expected.