Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326412

Summary: antRunner application doesn't seem to use the workspace locking mechanism
Product: [Eclipse Project] Platform Reporter: Thomas Hallgren <thomas>
Component: AntAssignee: Platform-Ant-Inbox <platform-ant-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: darin.eclipse, dj.houghton, john.arthorne, Michael_Rennie
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Thomas Hallgren CLA 2010-09-28 09:49:13 EDT
I have an Eclipse IDE running on a workspace. If I attempt to start an other IDE on the same workspace I immediately get the message "Workspace in use or cannot be created, choose a different one". So far so good.

Now I start another Eclipse to run an ant-script.Again on the same workspace:

/tools/eclipse -consolelog -nosplash -data /workspace -application org.eclipse.ant.core.antRunner -buildfile /workspace/some.project/build.xml

This command runs from start to finish without problems regardless of if I have another IDE running on the same workspace or not. I would expect it to fail when another instance is running and it's sometimes fatal that it doesn.t. Fatal in that it crashes the workspace so that I cannot restart the IDE on it.
Comment 1 Darin Wright CLA 2010-09-28 11:20:10 EDT
I'm not aware of the history on this. DJ or John, do you know if/how the Ant application entry point should/could consider the workspace lock?
Comment 2 John Arthorne CLA 2010-09-29 11:29:00 EDT
Yes, all applications that manipulate the platform instance location should be locking it when they start. For a headless application this is as simple as:

Location instance = Platform.getInstanceLocation();
if (instance == null)
  ... throw exception, instance location was not set
if (!instance.lock())
  ... throw exception, instance location could not be locked
Comment 3 Thomas Hallgren CLA 2010-10-11 04:21:09 EDT
So this is rather serious given that many ant applications indeed do manipulate the workspace and it's meta-data. I'm thinking about tasks like eclipse.incrementalBuild and eclipse.refreshLocal.
Comment 4 Szymon Ptaszkiewicz CLA 2011-02-18 13:18:27 EST
Possible duplicate of bug 262685.
Comment 5 Michael Rennie CLA 2011-02-21 21:46:46 EST

*** This bug has been marked as a duplicate of bug 262685 ***