在release:prepare和release:perform上都激活了配置文件 [英] Profile activation on both release:prepare and release:perform

查看:101
本文介绍了在release:prepare和release:perform上都激活了配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到在release:preparerelease:perform(两个)目标上激活某些Maven配置文件的解决方案.像这样:

I cannot find a solution for activating some Maven profile on release:prepare and release:perform (both) goals. Something like this:

<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概要文件在执行期间未处于活动状态.我在做错什么吗?

just doesn't work. I know that releaseProfiles setting works only during release:perform so I just though that arguments setting is exactly what I want, but my-profile profile is not active during the execution. Am I doing something wrong?

推荐答案

这看起来像是一个重复的问题.请看看这个问题,它有一个答案. maven版本插件会忽略releaseProfile

This looks like a duplicate question. Please take a look at this question, it has an answer. maven release plugin ignores releaseProfile

发布插件的基本版本2.2.1添加了releaseProfiles参数,该参数可让您定义要在发布期间启用的配置文件.

Basically version 2.2.1 of the release plugin adds a releaseProfiles parameter that will allow you to define the profiles to enable during release.

http://maven.apache.org /plugins/maven-release-plugin/examples/perform-release.html

不幸的是,似乎有一个错误会阻止它执行您想要的操作...

Unfortunately, it looks like there's a bug that will prohibit it from doing what you want...

修改

在这种情况下,我使用的一件事不是使用-P参数,而是通过使用-Denv=release的环境设置来触发配置文件.然后在POM中,我基于env的值激活了配置文件.这一直对我有用.

One thing that I have used in this case is not using the -P argument, but rather triggering the profile through an environment setting using -Denv=release. Then in the POM, I have the profile activation based on the value of env. This has always worked for me.

这篇关于在release:prepare和release:perform上都激活了配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆