83

I'm trying to get a target to build that has quite a long list of <pathelement location="${xxx}"/> and <path refid="foo.class.path"/> elements in its <path id="bar.class.path"> element (in the build.xml file). I keep getting "package com.somecompany.somepackage does not exist" errors, and I'm having a hard time chasing down these packages and making sure I've synced them from our repository.

I'm new to this team so I'm unfamiliar with the build, but I would prefer to figure this out myself if possible (so I don't bother the other very busy team members). I have very limited experience with Ant.

I think it would save me quite a bit of time if I could have Ant print out the classpath for the target I'm trying to build.

4

2 回答 2

126

使用pathconvert任务将路径转换为属性

<path id="classpath">
....
</path>

<pathconvert property="classpathProp" refid="classpath"/>

<echo>Classpath is ${classpathProp}</echo>

pathconvert 的文档

于 2010-03-12T04:56:07.470 回答
72

使用 Ant > 1.6 的版本更容易

<echo>${toString:classpath}</echo>

有关详细信息,请参阅http://ant.apache.org/manual/using.html#pathshortcut

于 2013-04-24T20:39:05.833 回答