在 Maven 中,我只想在工件尚未安装到存储库时执行构建。我的想法是使用默认情况下不活动的配置文件,但如果工件丢失,则会被激活。到目前为止我没有成功,因为似乎 Maven 属性不能用于配置文件激活?
设置.xml:
...
<localRepository>/local/m2repo</localRepository>
...
1)这有效:
pom.xml:
...
<profile>
<id>my-profile</id>
<activation>
<activeByDefault>false</activeByDefault>
<file>
<missing>/local/m2repo/something</missing>
</file>
</activation>
...
</profile>
2)这不起作用:
pom.xml:
...
<profile>
<id>my-profile</id>
<activation>
<activeByDefault>false</activeByDefault>
<file>
<missing>${settings.localRepository}/something</missing>
</file>
</activation>
...
</profile>
3)这也不起作用:
设置.xml:
...
<properties>
<local.repository>${settings.localRepository}</local.repository>
</properties>
...
pom.xml:
<profile>
<id>my-profile</id>
<activation>
<activeByDefault>false</activeByDefault>
<file>
<missing>${local.repository}/something</missing>
</file>
</activation>
</profile>
是否有某种解决方法或替代方法可以检查我的工件是否存在并且仅在必要时运行构建?感谢您的任何想法!