Maven Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 11: Line 11:
=Profile=
=Profile=


A ''profile'' is an alternative set of configurations which set or override default values. Profiles allow to customize a build for different environments. Profiles are configured in the <tt>pom.xml</tt> and each profile is identified with an identifier. Profiles customizes the build for different environments (e.g. production or development, different operating systems, different JDK versions, etc.)
A ''profile'' is an alternative set of configurations which set or override default values. Profiles allow to customize a build for different environments. Profiles can be defined:
* per project in the <tt>pom.xml</tt> file
* per-user in <tt>${user.home}/.m2/settings.xml</tt>
* global in <tt>${maven.home}/conf/settings.xml</tt>
 
Each profile is identified with an identifier. Profiles customizes the build for different environments (e.g. production or development, different operating systems, different JDK versions, etc.)


An example of profile:
An example of profile:
Line 42: Line 47:
mvn -Pproduction clear install
mvn -Pproduction clear install
</pre>
</pre>
More information: http://maven.apache.org/guides/introduction/introduction-to-profiles.html


=Multi-Module Maven Projects=
=Multi-Module Maven Projects=


* [[Multi-Module Maven Projects]]
* [[Multi-Module Maven Projects]]

Revision as of 01:21, 30 May 2016

Internal

POM

pom.xml

Profile

A profile is an alternative set of configurations which set or override default values. Profiles allow to customize a build for different environments. Profiles can be defined:

  • per project in the pom.xml file
  • per-user in ${user.home}/.m2/settings.xml
  • global in ${maven.home}/conf/settings.xml

Each profile is identified with an identifier. Profiles customizes the build for different environments (e.g. production or development, different operating systems, different JDK versions, etc.)

An example of profile:

...
<profiles> 
   <profile>
     <id>production</id>
         <build>
            <plugins>
              <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <configuration>
                      <debug>false</debug> 
                      <optimize>true</optimize>
                  </configuration>
                </plugin>
            </plugins>
         </build>
   </profile>
 </profiles>
...

The profile is activated on command line with -P:

mvn -Pproduction clear install

More information: http://maven.apache.org/guides/introduction/introduction-to-profiles.html

Multi-Module Maven Projects