简体   繁体   English

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

[英]how to get a value from pom file in ant

hi this is my pom file 嗨,这是我的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>

in ant i want to get value of abc.version> i am writing this code 在蚂蚁,我想获得的价值abc.version>我正在编写此代码

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

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

but it is not working,can anyone help please 但它不起作用,任何人都可以帮忙

您应该将其更改为:

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

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

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