Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default build profile for Maven

I have added profiling to my Maven project.

        <profile>             <id>da</id>                         </profile>         <profile>             <id>live</id>         </profile>         <profile>             <id>dev</id>         </profile> 

When I give the command mvn clean install without specifying the build profile. I need the dev profile to be build by default.

How can I achieve this?

like image 606
Isuru Avatar asked Aug 06 '12 07:08

Isuru


2 Answers

By using the attribute activeByDefault you will be able to select a default profile in Maven when no other profile is selected with the -P parameter.

<profiles>     <profile>         <id>da</id>                     </profile>     <profile>         <id>live</id>     </profile>     <profile>         <id>dev</id>         <activation>             <activeByDefault>true</activeByDefault>         </activation>     </profile> </profiles>      

See Maven Introduction to Profiles documentation

like image 136
FredrikO Avatar answered Sep 21 '22 15:09

FredrikO


You can also activate specific profile by running

mvn clean install -Pprod   

or

mvn clean install -Pdev 
like image 24
Pravin Bansal Avatar answered Sep 18 '22 15:09

Pravin Bansal