Why is the Eclipse ant editor warning me

I am having some problems (annoyingly) with the ANT editor in Eclipse, where it displays me the warning “Reference build.classpath not found”. on the next block:

<target name="generate" depends="..., mvn-depends"> <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask"> <classpath refid="build.classpath" /> </taskdef> ... </target> 

For the purpose, mvn-depends as follows:

 <target name="mvn-depends"> <artifact:dependencies pathId="build.classpath"> <pom refid="my.pom" /> </artifact:dependencies> </target> 

The rest of the links to build.classpath in the assembly file do not throw any warnings, and the assemblies and assemblies work fine without any errors, so this seems to be not so much.

However, ignoring the warning makes me feel dirty every time I have to edit this file. In particular, not knowing if this is a bug in the Eclipse ANT assembly file verification code or a potential problem in how the assembly file is structured that Eclipse identified.

If anyone has ideas on why this warning is displayed, and whether it is possible to ignore or even turn off preferences and want to share this knowledge, I would definitely be grateful for the knowledge.

Edit:

As requested, here is an example of a link to build.classpath that does not raise any warnings:

 <javac deprecation="off" debug="on" source="1.7" target="1.7" encoding="UTF-8" includeantruntime="false" memoryMaximumSize="512M" fork="true"> <classpath refid="build.classpath" /> </javac> 
+4
source share
2 answers

Since the editor can recognize refids and other elements that Ant specifies, I think the editor does something similar to the process of parsing the Ant build file.

That is, analyze this Ant build file in the Project object, and the links in <taskdef> can be checked, but <javac> not.

Since build.classpath is installed at runtime and it is installed by something other than <classpath> , Eclipse may not find it.

I have no convincing evidence. But something can be done to know us more.

  • First, copy <javac> to the same target where the <taskdef> warning exists to see if <javac> getting a warning;

  • Then copy the <taskdef> to the same target where the preetdefed <javac> exists to see if the <taskdef> warning remains,

  • Thirdly, in the target “generate” comment out the <taskdef> and check if the call <xjc ... /> receives a warning.

For the first, I expect “NO,” and for the other two, “YES.” Otherwise, my guess is incorrect.

And it makes sense that this is just a warning - things that Eclipse cannot find at edit time may exist at run time.

+1
source

Make sure that you have correctly specified the location of the path element as shown below.

 <property name="dependencyfinder.home" value="C:/DependencyFinder"/> <path id="dependencyfinder"> <pathelement location="${dependencyfinder.home}/lib/aaa.jar"/> </path> <taskdef classname="com.sun.tools.xjc.XJCTask"> <classpath refid="dependencyfinder"/> </taskdef> 

Note. DependencyFinder has a lib folder and lib has aaa.jar

Please check the link below for more information.
Press here

0
source

Source: https://habr.com/ru/post/1468915/


All Articles