Maven Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 12: Line 12:


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 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.)
An example of profile:
<pre>
...
<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>
...
</pre>
The profile is activated on command line with <tt>-P</tt>:
<pre>
mvn -Pproduction clear install
</pre>


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


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

Revision as of 01:17, 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 are configured in the pom.xml 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.)

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

Multi-Module Maven Projects