Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to activate profile based on goal being executed

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?

like image 728
Marcel Overdijk Avatar asked Apr 12 '13 06:04

Marcel Overdijk


1 Answers

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.

like image 56
Charlee Chitsuk Avatar answered Sep 23 '22 16:09

Charlee Chitsuk