在Maven中,我只想在构件尚未安装到存储库的情况下执行构建。我的想法是使用一个配置文件,该配置文件在默认情况下是不活动的,但如果工件丢失,它将被激活。到目前为止,我没有成功,因为似乎Maven属性不能用于配置文件激活?
settings.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)这也不起作用:
settings.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>有没有什么变通的办法或者替代方案,我可以检查我的工件是否存在,并在必要时才运行构建?谢谢你的任何想法!
发布于 2015-12-09 21:42:42
你不能这么做。
激活文件的位置通常相对于当前项目文件夹。
只有在已经定义了概要文件并开始构建之后,才会计算属性。
https://stackoverflow.com/questions/7321069
复制相似问题