[英]maven release plugin ignores releaseProfile
我使用兩個配置文件:開發和生產。
開發應在默認情況下有效; 我發布時應該使用生產。
在我的pom.xml中,我有:
[...]
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-9</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<goals>deploy</goals>
<arguments>-Pproduction</arguments>
</configuration>
</plugin>
[...]
<profiles>
<profile>
<id>production</id>
<properties>
<profile.name>production</profile.name>
</properties>
[...]
</profile>
<profile>
<id>development</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<profile.name>development</profile.name>
</properties>
[...]
</profile>
[...]
它只是不起作用。
useReleaseProfiles
也不起作用: http : useReleaseProfiles
開發配置文件應該始終處於活動狀態,但在運行mvn release:perform
時不會mvn release:perform
。 你是如何實現這一目標的?
[更新]:我已經看到調試標志使用了我的生產配置文件,但也使用了開發配置文件,因為它是activeByDefault
。 這不能被releaseProfile
參數覆蓋。 強制釋放插件僅使用“生產”配置文件會很好。
我認為你應該通過一個屬性來激活你的個人資料。
<profiles>
<profile>
<id>production</id>
<activation>
<property>
<name>build</name>
<value>release</value>
</property>
</activation>
[...]
</profile>
<profile>
<id>development</id>
<activation>
<property>
<name>build</name>
<value>develop</value>
</property>
</activation>
[...]
</profile>
<profiles>
通過執行類似的操作來構建您的構建
mvn -Dbuild=develop package
mvn -Dbuild=develop test
mvn -Dbuild=release release:prepare
mvn -Dbuild=release release:perform
如果選中“構建配置文件簡介” ,“取消激活配置文件”:
mvn groupId:artifactId:goal -P !profile-1,!profile-2
我想你可以用這個去激活你的默認配置文件?
這是一篇非常古老的帖子,但我最近才遇到這個問題。 當我將releaseProfiles設置為名為release的配置文件時,releaseProfile僅對我有用。 任何其他配置文件給出相同的錯
示例代碼:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<tagNameFormat>@{project.artifactId}-@{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<releaseProfiles>release</releaseProfiles>
<allowTimestampedSnapshots>true</allowTimestampedSnapshots>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<properties>
<connectionUrl>${scm-base}/tags/${project.artifactId}-${project.version}</connectionUrl>
</properties>
</profile>
</profiles>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.