在构建项目时,如果系统属性GIT_COMMIT不存在,我尝试激活maven配置文件。我在pom中的个人资料如下所示。注意!我的env.GIT_COMMIT变量前面的符号。
<profile>
<id>ci-buildno</id>
<activation>
<property>
<name>!env.GIT_COMMIT</name>
</property>
</activation>
<properties>
<buildText>SNAPSHOT</buildText>
</properties>
</profile>
当我构建项目时,我得到如下所示的错误。
$ mvn clean install
[INFO] Scanning for projects...
[WARNING] The POM for com.day.jcr.vault:content-package-maven-
plugin:jar:0.0.24 is missing, no dependency information available
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unresolveable build extension: Plugin com.day.jcr.vault:content-
package-maven-plugin:0.0.24 or one of its dependencies could not be
resolved: Failure to find com.day.jcr.vault:content-package-maven-
plugin:jar:0.0.24 in https://repo.maven.apache.org/maven2 was cached in
the local repository, resolution will not be reattempted until the update
interval of central has elapsed or updates are forced @
[ERROR] Unknown packaging: content-package @ Test-Project:test-
testcommons.ui.apps:[unknown-version], D:\testing\ui.apps\pom.xml, line
28, column 15
如果我要删除!然后构建它工作正常,构建成功。我可以把逆条件(删除后!)并将我的buildText更改为我想要的属性,但我想知道为什么这不会起作用!我仔细阅读了maven文档http://maven.apache.org/guides/introduction/introduction-to-profiles.html 并发现了!适用于系统属性。 GIT_COMMIT,我认为是一个系统属性,但不确定为什么这不起作用。
我可以在这里得到一些帮助吗?如果它有助于粘贴整个pom.xml,请告诉我。
谢谢!