如何从ant中的pom文件中获取值

时间:2012-06-14 10:27:45

标签: maven ant pom.xml

这是我的pom文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>mycompany.com</groupId>
        <artifactId>mercury</artifactId>
        <version>1249</version>
    </parent>

    <groupId>mycompany.com.tools.mm</groupId>
    <artifactId>parent</artifactId>
    <version>1249</version>
    <packaging>pom</packaging>
    <name>parent</name>
    <description>The parent to all MM projects</description>

    <properties>
        <mercury.version>@product.version@</mercury.version>
        <abc.version>7.0</abc.version>
    <metamodel.test>true</metamodel.test>
    </properties>
</project>

在蚂蚁中我想获得abc.version的价值&gt;我正在写这段代码

<artifact:pom id="mypom" file="C:\work\build\pom.template.xml" />

<echo>The version is ${mypom.properties.version}</echo>

但它不起作用,任何人都可以帮忙

1 个答案:

答案 0 :(得分:0)

您应将其更改为:

<echo>The version is ${mypom.properties.abc.version}</echo>