Bug 267128 - JDT's way of compiling thing should be compatible with other tools
Summary: JDT's way of compiling thing should be compatible with other tools
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-04 18:08 EST by Sven Köhler CLA
Modified: 2010-01-29 17:42 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Köhler CLA 2009-03-04 18:08:13 EST
Build ID: M20090211-1700

Steps To Reproduce:
In Eclipse, i can configure the following:

- Source Folders src1 and src
- src1 has output folder bin1
- src2 has output folder bin2
- class Test1 in src1 can depend on class Test2 in src2
- class Test2 in src2 can depend on class Test1 in src1

Note the circular dependency of the folders src1 and src2.

This is kind of "unique" and only available in Eclipse.
Actually I think it is impossible to write a build.xml which immitates this behaviour. And actually i think, that in most cases this is not what people want.

I had a bigger project, and we had a source folder for the regular application and a seperate source folder for unit tests. On a regular besis, I had to tell my code-developers that the regular source should not depend on the code that's in the source folder for the junit test.

My point is:
It's not possible to configure JDT in a way, such that these circular dependencies are NOT possible. IMHO, this should be possible, because it is the only way that most other build-systems (like ant) support.

AND it helps to have clean dependencies between the different parts of the project.
Comment 1 Sergey Vladimirov CLA 2009-03-21 19:06:56 EDT
Sven,

You can put your code in different projects and setup dependencies between projects. The compiler (by default) doesn't allow circular dependencies between projects.

Using source folders to maintain dependencies is not the right thing. Just think about wrong "possibilities" - next idea will be bind some libraries to some source folders, to try use different versions of libraries for different folders... This is what projects for, not source folders.
Comment 2 Sven Köhler CLA 2009-03-21 19:46:59 EDT
(In reply to comment #1)
> Sven,
> 
> You can put your code in different projects and setup dependencies between
> projects. The compiler (by default) doesn't allow circular dependencies between
> projects.

I would like to see the tutorial, where they recommend to put JUnit tests into another project to avoid the circual-dependency issue between source folders.

Isn't it a common thing to have a second source folder for the JUnit tests?
Comment 3 Nitin Dahyabhai CLA 2010-01-29 17:06:51 EST
Then wouldn't that require having JUnit as a dependency of your application code?  It's simpler to move the JUnit dependency and the tests into their own project and have that project establish a one-way dependency on the application code.
Comment 4 Sven Köhler CLA 2010-01-29 17:42:44 EST
(In reply to comment #3)
> Then wouldn't that require having JUnit as a dependency of your application
> code?  It's simpler to move the JUnit dependency and the tests into their own
> project and have that project establish a one-way dependency on the application
> code.

The basis of my complaint is, that Eclipse allows separate output folders for source folder, even if they depend circularly on each other.
This is something, that Eclipse probably shouldn't allow, since it can never be imitated with ant or any other build tool other than Eclipse.

JUnit tests were just an example and are not the main subject here.