Skip to content

Instantly share code, notes, and snippets.

@marcuslang
Created March 31, 2017 08:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcuslang/3e014f7051b8da313aa259c07ee15126 to your computer and use it in GitHub Desktop.
Save marcuslang/3e014f7051b8da313aa259c07ee15126 to your computer and use it in GitHub Desktop.
Aggregate pom for individual selection of Maven dependencies via profiles. Compose your dependencies/modules with profiles to generate different compositions
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<!-- your parent pom -->
</parent>
<modelVersion>4.0.0</modelVersion>
<name>myproject-${option1}</name>
<artifactId>aggregate</artifactId>
<build>
<finalName>myproject-${option1}-${project.version}</finalName>
</build>
<profiles>
<profile>
<id>option1_a</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<option1>option1_a</option1>
</properties>
<dependencies>
<dependency>
<!-- dependency to your module option1_a-->
</dependency>
</dependencies>
</profile>
<profile>
<id>option1_b</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<option1>option1_b</option1>
</properties>
<dependencies>
<dependency>
<!-- dependency to your module option1_b-->
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment