Maven Profile: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=External= * http://maven.apache.org/guides/introduction/introduction-to-profiles.html =Internal= * Maven Concepts =Overview= A ''profile'' is...") |
|||
Line 39: | Line 39: | ||
... | ... | ||
</pre> | </pre> | ||
=Specifying a Profile= | |||
The profile can be activated explicitly on command line with <tt>-P</tt>: | The profile can be activated explicitly on command line with <tt>-P</tt>: |
Revision as of 18:44, 26 October 2016
External
Internal
Overview
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> ...
Specifying a Profile
The profile can be activated explicitly on command line with -P:
mvn -Pproduction clear install
A profile can also be triggered through Maven settings, based on environment variables, OS settings, or present or missing files.