Reputation: 4587
I am using Maven repo and it is configured in settings.xml
<settings>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8080/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
Having a maven project in this order
parent
|
+child1
|
+child2
|
+child3
And configured profiles in parent pom,
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parent</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>child1</module>
<module>child2</module>
<module>child3</module>
</modules>
<profiles>
<profile>
<id>p1</id>
<modules>
<module>child1</module>
<module>child2</module>
</modules>
</profile>
<profile>
<id>p2</id>
<modules>
<module>child2</module>
<module>child3</module>
</modules>
</profile>
</profiles>
</project>
Now I want to build only child1 & child2, so I give the following command
mvn -P p1 clean
It is building all childs (child1, child2, child3)
mvn -P p1 help:active-profiles
shows following profiles are active,
How I can build only selective projects?
Upvotes: 0
Views: 962
Reputation: 97359
if you like to build a single child in your multi-module build you should use the command line like this:
mvn -pl child1 clean package
and may be you need to give
mvn -pl -amd child1 clean package
but don't use profiles for such purposes.
Upvotes: 1