简体   繁体   English

Ant:如何在包含refid时回显路径?

[英]Ant: How to echo a path when it contains a refid?

Please see this ant snippet below -- 请看下面的这个ant片段 -

<path id="classpath.ejb">
    <path refid="${java.class.path}"/>
    <pathelement location="${my.id}_session_${version.suffix}.jar"/>
</path>

Here I want to see the content of classpath.ejb , the fact is that it is composed of two elements, one is the generic system $CLASSPATH (supplied as a refid ) and the second one is some another jar. 这里我想看看classpath.ejb的内容,事实是它由两个元素组成,一个是泛型​​系统$CLASSPATH (作为refid ),第二个是另一个jar。 Just for my curiosity, I want to make sure the contents of classpath.ejb looks fine. 仅仅因为我的好奇心,我想确保classpath.ejb的内容看起来很好。 But when I try to echo like -- 但当我尝试回声时 -

<echo message="java.class.path: ${java.class.path}"/>
<echo message="classpath.ejb: ${toString:classpath.ejb}"/>

The first echo works, but in the second line, ant says that -- 第一个回声有效,但在第二行,蚂蚁说 -

BUILD FAILD
build.xml:103:Reference <...my whole $CLASSPATH string...> not found. 

Any idea ?? 任何想法 ??

Your <path> is faulty. 你的<path>有问题。 In this line: 在这一行:

<path refid="${java.class.path}"/>

You are saying the value of ${java.class.path} is a reference, but it's not, it is a 'string' path. 你说${java.class.path}的值是一个引用,但它不是,它是一个'字符串'路径。 Hence your error about a missing reference. 因此,您的错误参考错误。 You could change it to, for example, 例如,您可以将其更改为

<path path="${java.class.path}"/>

So that the classpath.ejb path is composed from the Java classpath and your 'session' jar. 因此classpath.ejb路径由Java类路径和“会话”jar组成。 Or else, see Path-like Structures in the Ant docs. 或者,请参阅Ant文档中的类路径结构

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM