Let us add a simple Maven profile to test our understanding of profiles.
Let's create a new Maven profile, by performing the following steps:
pom.xml
file:<profiles> <profile> <id>dev</id> <activation> <activeByDefault>false</activeByDefault> </activation> </profile> </profiles>
There are two ways to create a profile: in the project's pom file or in the settings file. It is important to note that, if a profile is active from the settings file, its values will override any profiles with equivalent IDs in the pom file.
The profile in pom.xml
can have the following elements:
<profile> <id>test</id> <activation>...</activation> <build>...</build> <modules>...</modules> <repositories>...</repositories> <pluginRepositories>...</pluginRepositories> <dependencies>...</dependencies> <reporting>...</reporting> <dependencyManagement>...</dependencyManagement> <distributionManagement>...</distributionManagement> </profile>
The profile in settings.xml
can only have the following elements:
<profile> <id>test</id> <activation>...</activation> <repositories>...</repositories> <pluginRepositories>...</pluginRepositories> <properties>…</properties> </profile>
3.14.141.115