如何在 POM.xml 中引用环境变量? [英] How to refer environment variable in POM.xml?

查看:134
本文介绍了如何在 POM.xml 中引用环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 maven 作为构建工具.我设置了一个名为 env 的环境变量.如何在 pom.xml 文件中访问此环境变量的值?

I am using maven as build tool. I have set an environment variable called env. How can I get access to this environment variable's value in the pom.xml file?

推荐答案

查看 Maven 属性指南...

正如 Seshagiri 在评论中指出的那样,${env.VARIABLE_NAME} 会做你想做的.

As Seshagiri pointed out in the comments, ${env.VARIABLE_NAME} will do what you want.

我将添加一个警告,并说 pom.xml 应该完整地描述您的项目,因此请谨慎使用环境变量.如果您的构建依赖于您的环境,它们将更难重现

I will add a word of warning and say that a pom.xml should completely describe your project so please use environment variables judiciously. If you make your builds dependent on your environment, they are harder to reproduce

这篇关于如何在 POM.xml 中引用环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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