我在 release:prepare
上找不到激活某些 Maven 配置文件的解决方案和 release:perform
(两者)目标。像这样的东西:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<goals>deploy</goals>
<arguments>-Pmy-release</arguments>
</configuration>
</plugin>
只是不起作用。我知道
releaseProfiles
设置仅在 release:perform
期间有效所以我只是认为 arguments
设置正是我想要的,但是 my-profile
profile 在执行期间不事件。难道我做错了什么?
最佳答案
这看起来像一个重复的问题。请看一下这个问题,它有答案。
maven release plugin ignores releaseProfile
基本上发布插件的 2.2.1 版添加了一个 releaseProfiles
允许您定义要在发布期间启用的配置文件的参数。
http://maven.apache.org/plugins/maven-release-plugin/examples/perform-release.html
不幸的是,看起来有一个错误会阻止它做你想做的事......
编辑
我在这种情况下使用的一件事是不使用 -P
参数,而是使用 -Denv=release
通过环境设置触发配置文件.然后在 POM 中,我根据 env
的值激活了配置文件。 .这一直对我有用。
关于maven - 两个版本 :prepare and release:perform 上的配置文件激活,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9994949/