Community
Participate
Working Groups
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.
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
Fixed for the 3.3 stream. *** This bug has been marked as a duplicate of bug 174759 ***