Community
Participate
Working Groups
We use Eclipse RC2 and 3 and have many projects that uses commonly two ant builders. One executes before the java builder to generate some sources. A second runs after the java builder to do the packaging for this project. To start the build I use the Clean command and select only this project. In our project the packaging build sometimes can not find all classes needed for the packaging leading to empty jars (manifest only). This behavior is not reliably reproducable. But I have created a java project that reproduces the problem. There is only one class 'Test' and an ant build file with one target that checks if the Test.class exists and echoes the set property. The first ant builder is configured to run before the java builder, and is expected to echo an undifined property. But the second ant builder should echo a defined property but it does not. Both ant builder can be configured exactly in the same way except of the position where to be executed and their names. Even if they are set to use a separate VM the result is the same. If I move the first ant builder to take place behind the java builder, the result is as expected. But only unchecking the pre buiilding ant builder is not enough. So I think if there is any pre buider defined the post builder doesen work correktly. Maby noteworthy is that if I deselect 'Build Automatically' the build is done twice per project. Then the first call to the post build behaves not correctly while the second call does. I'll try to add the demonstrating project as a Zip file.
Created attachment 12711 [details] project that reproduces the problem just extract the zip into your workspace and open the project ("_test").
Do you have the builders set to run in the foreground or the background? See the Build Options tab for the build. To ensure that the builds do not occur concurrently both builders will need to not launch in the background.
the 'run in background' checkbox is unchecked. But if I check 'Build Automatically' no modal dialog appears, when executing a Clean... on this project!
There appears to be a delay in the class file actually getting created depending on the build settings the user has. The way I could get this to work: I turned off Autobuilding using the Project menu Perform a Clean, Test class is correctly found Consistently failed: Autobuild is enabled (via the Project menu) Clean Test class is not found and appears to actually be created after all the builders have run (very noticeable if one puts a sleep in the buildfile...you can see the class file being created after the second external tool builder runs). I am also seeing the builders being triggered twice per project if autobuild is disabled. John, can you provide insight?
if I turn "launch in background" in the build options page of the ant builder, the Test.class ist found regardless of checking "Build Automatically" on or off!
ment: turn on "launch in background"
It sounds like the background ant building was the culprit. Does ExternalToolBuilder handle the case where two builders are running simultaneously? It looks like the builder has instance state that might get corrupted by two builders running simultanously (I believe the same builder instance is reused by the platform).
Two ant builds cannot run simultaneously if you are in the same VM (which I have tried and it fails as well). The builder may be reused but the state for the Ant build is not shared when in the same VM (a new classloader everything). To me it looks like the Ant builds are functioning correctly but the resource is not actually created until after the builders have finished.
Just another maybe helpful hint: If I choose Clean All... with Autobuild off (in the project menu) with many projects and open the details view in the modal dialog for the build process, there are several entries "Refreshing resources..." which seem to be blocked. Maybe such a blocking leads to ant builders not seeing the resources generated by builders that ran prior.
Created attachment 13661 [details] java project with 3 pre- and 3 postbuilders I have just created another little project with 3 pre- and 3 postbuilders, each running either due to a clean, incremental or auto build. With autobuild off doing a clean, the order of the execution is: clean prebuild clean postbuild incremental prebuild incremental postbuild With autobuild on the latter two are replaced by the corresponding auto pre/postbuilds. However between the clean pre- and postbuilds the java builder seems not to run or its output is not visible to the clean postbuild. The incremental prebuild can see the Test.class. However my understanding is that doing a clean build no other build is being executed. Antoher funny thing is, with autobuild on, when saving changes to a java file, I have two cycles of auto pre/postbuilds.
This bug is a duplicate of 70650 for the Clean / full build case (which we have a solution for which will be included in 3.0.1 and a patch is included in bug 70650). I am going to create a new bug for the autobuild / incremental case (which we currently do not have a solution for). See bug 71438. Thanks for your help in figuring this out. *** This bug has been marked as a duplicate of 70650 ***