Community
Participate
Working Groups
Build Identifier: 20100617-1415 Having 2 identical classes in different projects in the same workspace, breaks the incremental build. Apparently, when 1 class in 1 project compiles, it forces the other project(s) to recompile as well. Even changing (w/o saving) a resource, causes the full build of the workspace. ALL the projects in the workspace are recompiled as well. So, if there is an independent project 3 in the workspace, it will get recompiled as well. The only way to ameliorate it is to uncheck "Rebuild class files modified by others" in Window->Preferences->Java->Compiler->Building Reproducible: Always Steps to Reproduce: 1. create 2 projects compiling into 1 output location. Both projects will have an identical class: say com.eclipse.TestClass. 2. In settings, Window->Preferences->Java->Compiler->Building, uncheck "Scrub output folders when cleaning projects" and check "Rebuild class files modified by others" under Output folder section. Make sure the projects' use this global configuration. 3. Also, make sure Build Automatically is checked under Project menu. 4. Now, you should see that changing any file results in full build of the workspace. Saving a mod to a java class also results in full build. Starting eclipse in debug mode, you might see something like following: ---------------------------------------------------------- Finished build of <PROJECT> @ <DATE> Starting build of <PROJECT 1> @ <DATE> Found source delta for: <PROJECT 1> Found binary delta for: <PROJECT 2> Clearing last state : State for <PROJECT 1> (#0 @ <DATE>) INCREMENTAL build MUST DO FULL BUILD. Found change to class file com/eclipse/TestClass Performing full build since incremental build failed Clearing last state : State for <PROJECT 1> (#0 @ <DATE>) FULL build ----------------------------------------
This did not happen in eclipse prior to Helios.
(In reply to comment #0) > Steps to Reproduce: > 1. create 2 projects compiling into 1 output location. Hm, I've never seen that before. Out of curiosity: What advantage do you get from compiling both projects into the same output location?
(In reply to comment #0) >[..] > Steps to Reproduce: > 1. create 2 projects compiling into 1 output location. How did you do this exactly? Can you break it down to the exact steps you followed? Thanks.
(In reply to comment #2) > (In reply to comment #0) > > Steps to Reproduce: > > 1. create 2 projects compiling into 1 output location. > > Hm, I've never seen that before. Out of curiosity: What advantage > do you get from compiling both projects into the same output location? The only advantage so far is to reuse the code by making it more modular. So, if there is a utility project, other projects may be dependent on it. We used to have 1 large project, but now we are in the process of breaking it up. Apparently some classes got duplicated in several projects.
(In reply to comment #3) > (In reply to comment #0) > >[..] > > Steps to Reproduce: > > 1. create 2 projects compiling into 1 output location. > > How did you do this exactly? Can you break it down to the exact steps you > followed? Thanks. See my description of how to reproduce this. Only #1 of my steps seems to need more details. In the project's properties, you can go to Java Build Pat -> Source. Check Allow output folders for source folders. Under project src, select Output folder and press Edit button. In the new window select radio "Specific output folder" and hit Browse. Press Create New Folder in the new window to create a folder in the project. Give that folder a name (eg. "target") and click Advanced. In the new window you can link the "target" folder to any folder on the file system. You can do these steps for several projects to make them compile into 1 place/folder.
(In reply to comment #4) > (In reply to comment #2) > > (In reply to comment #0) > > > Steps to Reproduce: > > > 1. create 2 projects compiling into 1 output location. > > > > Hm, I've never seen that before. Out of curiosity: What advantage > > do you get from compiling both projects into the same output location? > > The only advantage so far is to reuse the code by making it more modular. > So, if there is a utility project, other projects may be dependent on it. > > We used to have 1 large project, but now we are in the process of breaking it > up. > Apparently some classes got duplicated in several projects. We store projects separately but compile them into Tomcat's Web-INF/classes directory. Not all projects are built by a developer. However developers may share some base projects: eg. "utility".
Created attachment 179807 [details] attached projects Thanks for the detailed steps. I tried to reproduce using the steps on the attached project here with latest I build (I20100922-0800), but couldn't. Can you please check if you still get the problem on the new I build? Or perhaps use the attached project and see if i'm missing something. It has two duplicate classes - ABC and DupClass. I have these two in my workspace plus the sources for jdt core plugin. Making any changes doesn't trigger the full build.
(In reply to comment #7) > Created an attachment (id=179807) [details] > attached projects > > Thanks for the detailed steps. I tried to reproduce using the steps on the > attached project here with latest I build (I20100922-0800), but couldn't. Can > you please check if you still get the problem on the new I build? Or perhaps > use the attached project and see if i'm missing something. It has two duplicate > classes - ABC and DupClass. I have these two in my workspace plus the sources > for jdt core plugin. Making any changes doesn't trigger the full build. Very good Ayushman! I created another workspace with Both projects A and B. Also 1. I did step 2 in my description: "Window->Preferences->Java->Compiler->Building, uncheck "Scrub output folders when cleaning projects" and check "Rebuild class files modified by others" under Output folder section. Make sure the projects' use this global configuration." 2. I started eclipse in debug mode: C:\eclipse\eclipse.exe -debug c:\temp\eclipse_start.options -vm "C:\Program Files (x86)\Java\jdk1.6.0_20\jre\bin\java.exe" c:\temp\eclipse_start.options file contains the following: # Turn on debug tracing for org.eclipse.jdt.core plugin org.eclipse.jdt.core/debug=true # Reports incremental builder activity : nature of build, built state reading, indictment process org.eclipse.jdt.core/debug/builder=true You should see an extra Eclipse debug window. Here is the debug output I am seeing on changing and saving ABC.java: ---------- Starting build of A @ Wed Sep 29 11:33:24 CDT 2010 Found source delta for: A Clearing last state : State for A (#0 @ Wed Sep 29 11:30:00 CDT 2010) INCREMENTAL build MUST DO FULL BUILD. Found change to class file ABC Performing full build since incremental build failed Clearing last state : State for A (#0 @ Wed Sep 29 11:30:00 CDT 2010) FULL build About to compile src/p/DupClass.java About to compile src/ABC.java Writing changed class file DupClass.class Writing changed class file ABC.class Recording new state : State for A (#0 @ Wed Sep 29 11:33:24 CDT 2010) Finished build of A @ Wed Sep 29 11:33:25 CDT 2010 Starting build of B @ Wed Sep 29 11:33:25 CDT 2010 Found source delta for: B Clearing last state : State for B (#0 @ Wed Sep 29 11:30:00 CDT 2010) INCREMENTAL build MUST DO FULL BUILD. Found change to class file ABC Performing full build since incremental build failed Clearing last state : State for B (#0 @ Wed Sep 29 11:30:00 CDT 2010) FULL build About to compile src/p/DupClass.java About to compile src/p/A.java About to compile src/ABC.java Writing changed class file DupClass.class Writing changed class file A.class Writing changed class file ABC.class Recording new state : State for B (#0 @ Wed Sep 29 11:33:25 CDT 2010) Finished build of B @ Wed Sep 29 11:33:25 CDT 2010 If I just change ABC but do not save it, I get the same message but with a slight time delay. So, any change in such a project triggers a FULL build. That was not happening before Helios.
(In reply to comment #7) > Created an attachment (id=179807) [details] > attached projects > > Thanks for the detailed steps. I tried to reproduce using the steps on the > attached project here with latest I build (I20100922-0800), but couldn't. Can > you please check if you still get the problem on the new I build? Or perhaps > use the attached project and see if i'm missing something. It has two duplicate > classes - ABC and DupClass. I have these two in my workspace plus the sources > for jdt core plugin. Making any changes doesn't trigger the full build. One more thing, If I do not save the file (ABC.java) and keep it like that opened in the workspace, Full build seems to be triggered every 5 min automatically. Here is the debug log: Starting build of A @ Wed Sep 29 11:55:01 CDT 2010 Found source delta for: A Clearing last state : State for A (#0 @ Wed Sep 29 11:54:26 CDT 2010) INCREMENTAL build MUST DO FULL BUILD. Found change to class file ABC Performing full build since incremental build failed Clearing last state : State for A (#0 @ Wed Sep 29 11:54:26 CDT 2010) FULL build About to compile src/p/DupClass.java About to compile src/ABC.java Writing changed class file DupClass.class Writing changed class file ABC.class Recording new state : State for A (#0 @ Wed Sep 29 11:55:01 CDT 2010) Finished build of A @ Wed Sep 29 11:55:01 CDT 2010 Starting build of B @ Wed Sep 29 11:55:01 CDT 2010 Found source delta for: B Clearing last state : State for B (#0 @ Wed Sep 29 11:54:26 CDT 2010) INCREMENTAL build MUST DO FULL BUILD. Found change to class file ABC Performing full build since incremental build failed Clearing last state : State for B (#0 @ Wed Sep 29 11:54:26 CDT 2010) FULL build About to compile src/p/DupClass.java About to compile src/p/A.java About to compile src/ABC.java Writing changed class file DupClass.class Writing changed class file A.class Writing changed class file ABC.class Recording new state : State for B (#0 @ Wed Sep 29 11:55:01 CDT 2010) Finished build of B @ Wed Sep 29 11:55:01 CDT 2010 Starting build of A @ Wed Sep 29 12:00:02 CDT 2010 Found source delta for: A Clearing last state : State for A (#0 @ Wed Sep 29 11:55:01 CDT 2010) INCREMENTAL build MUST DO FULL BUILD. Found change to class file ABC Performing full build since incremental build failed Clearing last state : State for A (#0 @ Wed Sep 29 11:55:01 CDT 2010) FULL build About to compile src/p/DupClass.java About to compile src/ABC.java Writing changed class file DupClass.class Writing changed class file ABC.class Recording new state : State for A (#0 @ Wed Sep 29 12:00:02 CDT 2010) Finished build of A @ Wed Sep 29 12:00:02 CDT 2010 Starting build of B @ Wed Sep 29 12:00:02 CDT 2010 Found source delta for: B Clearing last state : State for B (#0 @ Wed Sep 29 11:55:01 CDT 2010) INCREMENTAL build MUST DO FULL BUILD. Found change to class file ABC Performing full build since incremental build failed Clearing last state : State for B (#0 @ Wed Sep 29 11:55:01 CDT 2010) FULL build About to compile src/p/DupClass.java About to compile src/p/A.java About to compile src/ABC.java Writing changed class file DupClass.class Writing changed class file A.class Writing changed class file ABC.class Recording new state : State for B (#0 @ Wed Sep 29 12:00:02 CDT 2010) Finished build of B @ Wed Sep 29 12:00:02 CDT 2010 Starting build of A @ Wed Sep 29 12:05:02 CDT 2010 Found source delta for: A Clearing last state : State for A (#0 @ Wed Sep 29 12:00:02 CDT 2010) INCREMENTAL build MUST DO FULL BUILD. Found change to class file ABC Performing full build since incremental build failed Clearing last state : State for A (#0 @ Wed Sep 29 12:00:02 CDT 2010) FULL build About to compile src/p/DupClass.java About to compile src/ABC.java Writing changed class file DupClass.class Writing changed class file ABC.class Recording new state : State for A (#0 @ Wed Sep 29 12:05:02 CDT 2010) Finished build of A @ Wed Sep 29 12:05:02 CDT 2010 Starting build of B @ Wed Sep 29 12:05:02 CDT 2010 Found source delta for: B Clearing last state : State for B (#0 @ Wed Sep 29 12:00:02 CDT 2010) INCREMENTAL build MUST DO FULL BUILD. Found change to class file ABC Performing full build since incremental build failed Clearing last state : State for B (#0 @ Wed Sep 29 12:00:02 CDT 2010) FULL build About to compile src/p/DupClass.java About to compile src/p/A.java About to compile src/ABC.java Writing changed class file DupClass.class Writing changed class file A.class Writing changed class file ABC.class Recording new state : State for B (#0 @ Wed Sep 29 12:05:02 CDT 2010) Finished build of B @ Wed Sep 29 12:05:02 CDT 2010
Dmitriy, whilst i agree that a full build is being triggered for projects A and B, what i was trying to figure out is the validity of your claim - "ALL the projects in the workspace are recompiled as well. So, if there is an independent project 3 in the workspace, it will get recompiled as well." Your debug outputs till now and also my investigation confirms that this is not true. The reason for the full build being triggered for A and B may be because they both have a class with the same name, and the resulting class file for both gets compiled into the same folder. This combined with the option "Rebuild class files modified by others" must be triggering the full build. This may be correct behaviour. Srikanth, what do you think?
(In reply to comment #10) > Dmitriy, whilst i agree that a full build is being triggered for projects A and > B, what i was trying to figure out is the validity of your claim - "ALL the > projects in the workspace are recompiled as well. So, if there is an > independent project 3 in the workspace, it will get recompiled as well." Your > debug outputs till now and also my investigation confirms that this is not > true. The reason for the full build being triggered for A and B may be because > they both have a class with the same name, and the resulting class file for > both gets compiled into the same folder. This combined with the option "Rebuild > class files modified by others" must be triggering the full build. This may be > correct behaviour. > > Srikanth, what do you think? I introduced another project C with class O.java in the package p in this same workspace). After I change class O, I am seeing full build for all the projects with collisions: Starting build of A @ Thu Sep 30 10:35:57 CDT 2010 Found source delta for: A Clearing last state : State for A (#0 @ Thu Sep 30 10:34:54 CDT 2010) INCREMENTAL build MUST DO FULL BUILD. Found change to class file ABC Performing full build since incremental build failed Clearing last state : State for A (#0 @ Thu Sep 30 10:34:54 CDT 2010) FULL build About to compile src/p/DupClass.java About to compile src/ABC.java Writing changed class file DupClass.class Writing changed class file ABC.class Recording new state : State for A (#0 @ Thu Sep 30 10:35:57 CDT 2010) Finished build of A @ Thu Sep 30 10:35:57 CDT 2010 Starting build of B @ Thu Sep 30 10:35:57 CDT 2010 Found source delta for: B Clearing last state : State for B (#0 @ Thu Sep 30 10:34:54 CDT 2010) INCREMENTAL build MUST DO FULL BUILD. Found change to class file ABC Performing full build since incremental build failed Clearing last state : State for B (#0 @ Thu Sep 30 10:34:54 CDT 2010) FULL build About to compile src/p/DupClass.java About to compile src/p/A.java About to compile src/ABC.java Writing changed class file DupClass.class Writing changed class file A.class Writing changed class file ABC.class Recording new state : State for B (#0 @ Thu Sep 30 10:35:57 CDT 2010) Finished build of B @ Thu Sep 30 10:35:57 CDT 2010 Starting build of C @ Thu Sep 30 10:35:57 CDT 2010 Found source delta for: C Clearing last state : State for C (#4 @ Thu Sep 30 10:34:07 CDT 2010) INCREMENTAL build Compile this changed source file src/p/O.java About to compile src/p/O.java Writing changed class file O.class Recording new state : State for C (#5 @ Thu Sep 30 10:34:07 CDT 2010) Finished build of C @ Thu Sep 30 10:35:57 CDT 2010 _____________________________ This seems wasteful: we don't want a full build of projects with collisions on any resource change. This is still (NOT?) working in eclipse before Helios. Let me know if going forward this is going to be the expected behavior.
Why do you have twice the same class in two projects ?
(In reply to comment #11) [..] > I introduced another project C with class O.java in the package p in this same > workspace). After I change class O, I am seeing full build for all the > projects with collisions: Wrong observation once again. Only A and B are fully build. Incremental build is successful for C. See your own console output below: > Starting build of C @ Thu Sep 30 10:35:57 CDT 2010 > Found source delta for: C > Clearing last state : State for C (#4 @ Thu Sep 30 10:34:07 CDT 2010) > INCREMENTAL build > Compile this changed source file src/p/O.java > About to compile src/p/O.java > Writing changed class file O.class > Recording new state : State for C (#5 @ Thu Sep 30 10:34:07 CDT 2010) > Finished build of C @ Thu Sep 30 10:35:57 CDT 2010 Hence we can atleast conclude that only the projects having the same class, compiling into the same folder are fully build.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
According to comment 4 the whole scenario seems to be driven by an attempt to fake a project dependency in some weird way. Whichever way you look at it, compiling two classes to the same location will always give unreliable results. Unless I'm missing s.t. essential this is a WONTFIX.
Verified for Eclipse 4.13 M1 with Build id: I20190709-1800 [nothing to verify]