How to tell Eclipse to ignore errors in an Ant build.xml?

21,557

Solution 1

Window-> Preferences -> Ant -> Editor -> Problems (Tab)
check 'Ignore all buildfile problems'

Solution 2

Go to Window->preferences->Ant->Problems tab. Add "build.xml" to the ignore list.

I found this workaround here.

But my recommendation would be (if possible) to rename your build.xml first and only add this new build-filename to the ignore list. Then you avoid to ignore all other build.xml files in your eclipse workspace. That's how I use it :-)

Solution 3

Use javac option

failonerror="false"

<javac includeantruntime="false" srcdir="${src}" destdir="${build}" failonerror="false"/>

Solution 4

I found another workaround using the antcontrib task if-"Dummy-Wrapping" I already had included in our build framework:

<target ...>
  <if><istrue value="on" /><then> <!-- remove annoying "tst.local.ant.targets.show.out doesn't exist" warning in Eclipse Problems view and Ant View -->
    <loadfile property="in" srcfile="${tmpOut}.out">
      <filterchain><expandproperties/></filterchain></loadfile>
  </then></if>
  ...
</target>
Share:
21,557

Related videos on Youtube

matt b
Author by

matt b

Hello, world!

Updated on December 09, 2020

Comments

  • matt b
    matt b over 3 years

    I have an Eclipse project which is built using Maven, and I'm using the m2eclipse plugin inside Eclipse for it's Maven support.

    However this project also contains a build.xml which is not used for actually building the project, but just for scripting capabilities as a utility for developers on the project - it is not used in building or packaging the product (just helping to automate some side tasks the developers often have to invoke on the side).

    Whenever this file is opened in an editor in Eclipse, Eclipse notices what it thinks is a problem with some missing declarations in the build.xml and begins to display errors for the project (in the Problems view) along with a red X icon/marker for the project to show that there are build errors. These aren't even true problems with the build.xml, just some problems that Eclipse thinks are present because it is not able to import all of the other dependent files this build.xml is using. There are no "build" errors with the project, just errors in what Eclipse (in it's infinite wisdom) is able to parse about a build.xml used for auxiliary purposes.

    Is there any way to tell Eclipse to ignore a build.xml or ignore Ant warnings in a particular project? Do I need to remove the Java Builder from the Builders tab of the project properties?

  • matt b
    matt b over 13 years
    This would set the preference globally - I'd like to still get these errors in projects that are truly using Ant for building though. Do you know of a way to disable it for just one project, to tell Eclipse that Ant is not used as a part of the building process of this project?
  • Bivas
    Bivas over 13 years
    Select a project and set specific setting per that project
  • matt b
    matt b over 13 years
    There are not Ant preferences or tab in the project properties for an individual project