Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 68293 - ant builder cant find files created by java builder
Summary: ant builder cant find files created by java builder
Status: RESOLVED DUPLICATE of bug 70650
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-Ant-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-23 09:24 EDT by Thomas Schniewind CLA
Modified: 2004-08-04 19:33 EDT (History)
1 user (show)

See Also:


Attachments
project that reproduces the problem (3.52 KB, application/x-zip-compressed)
2004-06-23 09:41 EDT, Thomas Schniewind CLA
no flags Details
java project with 3 pre- and 3 postbuilders (6.80 KB, application/x-zip-compressed)
2004-07-29 04:51 EDT, Thomas Schniewind CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schniewind CLA 2004-06-23 09:24:44 EDT
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.
Comment 1 Thomas Schniewind CLA 2004-06-23 09:41:30 EDT
Created attachment 12711 [details]
project that reproduces the problem

just extract the zip into your workspace and open the project ("_test").
Comment 2 Darin Swanson CLA 2004-06-23 09:56:36 EDT
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.
Comment 3 Thomas Schniewind CLA 2004-06-23 11:32:27 EDT
the 'run in background' checkbox is unchecked. But if I check 'Build 
Automatically' no modal dialog appears, when executing a Clean... on this 
project!
Comment 4 Darin Swanson CLA 2004-06-23 12:46:43 EDT
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?
Comment 5 Thomas Schniewind CLA 2004-06-23 12:54:27 EDT
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!
Comment 6 Thomas Schniewind CLA 2004-06-23 12:55:32 EDT
ment: turn on "launch in background" 
Comment 7 John Arthorne CLA 2004-06-23 15:32:50 EDT
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).
Comment 8 Darin Swanson CLA 2004-06-23 15:42:20 EDT
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.
Comment 9 Thomas Schniewind CLA 2004-06-24 06:52:17 EDT
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.
Comment 10 Thomas Schniewind CLA 2004-07-29 04:51:57 EDT
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.
Comment 11 Darin Swanson CLA 2004-08-04 19:33:19 EDT
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 ***