Maven 可以忽略丢失的系统属性吗?

发布于 2025-01-08 11:36:26 字数 475 浏览 4 评论 0原文

如果我的 pom 文件中有以下内容:

<properties>
    <mySystemProperty>${mySystemProperty}</mySystemProperty>
</properties>

当我使用“mvn clean install -DmySystemProperty=someData”构建时,它会成功构建。如果我使用“mvn clean install”构建它,我不需要指定系统属性,Maven 会给我这个错误:

Resolving expression: '${mySystemProperty}': Detected the following recursive expression cycle in 'mySystemProperty'

有没有办法让 maven 忽略丢失的系统属性?如果没有的话有办法默认吗?

If I have the following in my pom file:

<properties>
    <mySystemProperty>${mySystemProperty}</mySystemProperty>
</properties>

When I build using "mvn clean install -DmySystemProperty=someData", it builds successfully. If I build it using "mvn clean install", where I don't need to specify the system property, Maven gives me this error:

Resolving expression: '${mySystemProperty}': Detected the following recursive expression cycle in 'mySystemProperty'

Is there a way to get maven to ignore the missing system property? If not, is there a way to default it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泅渡 2025-01-15 11:36:26

解决了。系统变量和 maven 变量使用相同的名称导致了问题。重命名系统变量修复了错误。

<properties>
    <mySystemProperty>${sysProperty}</mySystemProperty>
</properties>

Solved it. Using the same name for the system variable and maven variable caused the problem. Renaming the system variable fixed the error.

<properties>
    <mySystemProperty>${sysProperty}</mySystemProperty>
</properties>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文