Maven Pom xml变量 [英] maven pom xml variables

查看:44
本文介绍了Maven Pom xml变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置依赖项时.让我们假设以下

When setting a dependency. Let's assume the following

<dependency>
        <groupId>com.atlassian.plugins</groupId>
        <artifactId>atlassian-plugins-osgi-testrunner</artifactId>
        <version>${plugin.testrunner.version}</version>
        <scope>test</scope>
</dependency>

${plugin.testrunner.version}

变量被初始化了吗?是否有属性文件或它在哪里获得价值?

variable get initialized? Is there a properties file or where does it gets it value?

推荐答案

应在属性部分中将其初始化,与依赖项部分处于同一级别,例如

This should be intialised in a properties section, at the same level as your dependencies section, eg

<project>
    <properties>
        <plugin.testrunner.version>1.0</plugin.testrunner.version>
    </properties>
...
    <dependencies>
...
    </dependencies>
</project>

如果您有一个带有父pom.xml的多项目应用程序,通常会将所有属性放在其中,以便所有单独的pom都可以使用它们.

If you have a multi project application with a parent pom.xml it's common to put all your properties in there so they can be used by all of the individual poms.

这篇关于Maven Pom xml变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆