Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 165559 - Ant import task causing spurious errors in problems window and broken outline view
Summary: Ant import task causing spurious errors in problems window and broken outline...
Status: RESOLVED DUPLICATE of bug 174759
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Ant-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-22 18:08 EST by Mark Jenner CLA
Modified: 2007-03-16 16:38 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Jenner CLA 2006-11-22 18:08:26 EST
I am using the import task in Ant to bring in some shared targets into my build script.  When I first open the build.xml file it is ok, but when edit it and the file is reparsed I get the following problems:

- Each part of the file is shown in the outline view with [from null] at the end e.g from the files below
"test {from null]"
"imported-target [from import build-shared-targets.xml [from null]]

- When I edit the file it no longer indents properly when I add new lines of code
- An error is displayed in the problems window for targets used which are in the imported file (this happens in my real buildfile, but not in my simple reproduction script below)
- A warning is displayed in the problems window because it cannot find the import file (this happens in my real buildfile, but not in my simple reproduction script below)
- The following stack trace was produced in the error log:

Error logged from Ant UI:

java.lang.NullPointerException
at java.io.File.<init>(Unknown Source)
at org.apache.tools.ant.helper.AntXMLContext.setBuildFile(AntXMLContext.java:115)
at org.eclipse.ant.internal.ui.editor.utils.ProjectHelper.parse(ProjectHelper.java:569)
at org.eclipse.ant.internal.ui.editor.utils.ProjectHelper.parse(ProjectHelper.java:651)
at org.eclipse.ant.internal.ui.model.AntModel.parseDocument(AntModel.java:315)
at org.eclipse.ant.internal.ui.model.AntModel.reconcile(AntModel.java:263)
at org.eclipse.ant.internal.ui.editor.text.XMLReconcilingStrategy.internalReconcile(XMLReconcilingStrategy.java:43)
at org.eclipse.ant.internal.ui.editor.text.XMLReconcilingStrategy.reconcile(XMLReconcilingStrategy.java:56)
at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:75)
at org.eclipse.ant.internal.ui.editor.text.NotifyingReconciler.process(NotifyingReconciler.java:39)
at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:204)

Session data:
eclipse.buildId=M20060921-0945
java.version=1.5.0_06
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_GB
Command-line arguments:  -os win32 -ws win32 -arch x86

Here are the build scripts I used to reproduce this:

<project name="importer" basedir=".">
	
	<import file="build-shared-targets.xml"/>
	
	<target name="test" depends="imported-target" >
		<echo message="test" />
	</target>
	
</project>

<project name="imported" >

	<target name="imported-target">
		<echo message="imported target" />
	</target>
	
</project>

Even if the outline view has been broken, and their are errors in the problems window, the build file still works fine.

Workaround: close the editor window and reopen it.  The outline will be correct. Once you edit something it will break.
Comment 1 Stefan Baramov CLA 2007-01-05 13:52:36 EST
Here is another workaround: Replace the org.eclipse.ant.ui_3.2.1.r321_v20060828.jar file of the Eclipse 3.2.1 with the org.eclipse.ant.ui_3.2.0.v20060531.jar file of the Eclipse 3.2.0 Distribution. Make sure Eclipse IDE is not running during the replace operation and backup the original file. 

It worked for me, but may not work for you. Yes, nasty hack but then, the Ant Editor in 3.2.1 is really messed up, sorry.

- Stefan
Comment 2 Darin Swanson CLA 2007-03-16 16:38:29 EDT
Fixed for the 3.3 stream.

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