使用 jgitflow Maven 插件完成发布时激活配置文件?
Activate profile when finishing release using jgitflow Maven plugin?
我有一个 Maven 配置文件 documentation
,我想在 运行 mvn jgitflow:release-finish
时激活它。我知道我能做到:
mvn jgitflow:release-finish -Pdocumentation
因为插件的文档说明:
automatically copies any profiles (-P) and user-properties (-D) passed on the command line to the forked maven process when building
但这意味着您不能忘记手动添加此配置文件。
Objective:我希望能够配置 Maven 以便此配置文件自动激活(或者我可以以某种方式在 'release' 配置文件处于活动状态)。
jgitflow:release-finish
目标实际上使用默认选项 useReleaseProfile
定义:
Whether to use the release profile that adds sources and javadocs to the released artifact, if appropriate. If set to true
, the plugin sets the property performRelease
to true
, which activates the profile "release-profile", which is inherited from the super pom.
此选项的默认值为 true
,因此在执行此目标时将默认将 performRelease
属性 设置为 true
。
注意上面提到的release profile是由super POM, which is actually used by this plugin but also by the maven-release-plugin
via the similar useReleaseProfile
选项定义的
然后您也可以根据此选项激活您的 profile,如下所示:
<profiles>
<profile>
<id>documentation</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
...
</profile>
</profiles>
这意味着您仍然可以通过 -P
选项明确激活它,并且它也会被目标自动激活。
我有一个 Maven 配置文件 documentation
,我想在 运行 mvn jgitflow:release-finish
时激活它。我知道我能做到:
mvn jgitflow:release-finish -Pdocumentation
因为插件的文档说明:
automatically copies any profiles (-P) and user-properties (-D) passed on the command line to the forked maven process when building
但这意味着您不能忘记手动添加此配置文件。
Objective:我希望能够配置 Maven 以便此配置文件自动激活(或者我可以以某种方式在 'release' 配置文件处于活动状态)。
jgitflow:release-finish
目标实际上使用默认选项 useReleaseProfile
定义:
Whether to use the release profile that adds sources and javadocs to the released artifact, if appropriate. If set to
true
, the plugin sets the propertyperformRelease
totrue
, which activates the profile "release-profile", which is inherited from the super pom.
此选项的默认值为 true
,因此在执行此目标时将默认将 performRelease
属性 设置为 true
。
注意上面提到的release profile是由super POM, which is actually used by this plugin but also by the maven-release-plugin
via the similar useReleaseProfile
选项定义的
然后您也可以根据此选项激活您的 profile,如下所示:
<profiles>
<profile>
<id>documentation</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
...
</profile>
</profiles>
这意味着您仍然可以通过 -P
选项明确激活它,并且它也会被目标自动激活。