如何根据执行的目标激活配置文件 [英] How to activate profile based on goal being executed

查看:153
本文介绍了如何根据执行的目标激活配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从命令行执行某些目标时,我想激活一个配置文件'自动'。



例如,现在我在做什么:

  mvn appengine:devserver -Pdevelopment 

mvn appengine:update - Pproduction

基本上我想在运行devserver目标时自动激活开发概要文件。
对于我在运行更新目标时要激活的生产配置文件,它是一样的(除非使用-P选项明确覆盖)。

这可能吗? Maven Model 告诉我们个人资料包含各种元素,包括 build 。如下例所示: -

< profile>
< id>< / id>
...
< build>
< plugins>
< plugin>< / plugin>
...
< / plugins>
< / build>
< / profile>

如上所述,概况控制插件。那么你的问题的答案是否定的。我们不能让插件激活配置文件



我希望这可以帮助。


When I execute certain goals from the command line I would like to activate a profile 'automatically'.

E.g. what I'm doing now:

mvn appengine:devserver -Pdevelopment

mvn appengine:update -Pproduction

Basically I want to activate the development profile automatically as I run the devserver goal. The same for the production profile which I want to activate when I run the update goal (unless explicitly overridden using -P option).

Is this possible?

解决方案

The Maven Model told us as the profile consists of various elements, including with build. as the following example: -

<profile>
    <id></id>
    ...
    <build>
        <plugins>
           <plugin></plugin>
           ...
        </plugins>
    </build>
</profile>

As we have seen above, the profile controls the plugin. Then the answer to your question is no. We cannot let the plugin to activate the profile.

I hope this may help.

这篇关于如何根据执行的目标激活配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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