Is it possible for Maven to assembly executable JARs with different configurations?
<p>I have a project with the following conceptual structure:</p>

<pre><code>-- Core project: Contains the main() function
---- Feature A
---- Feature B
---- Feature C
---- etc.
</code></pre>

<p>I am looking for a way to tell maven the following:</p>

<p><code>mvn package core--with--featureA--and--featureC</code></p>

<p>This example would create an executable JAR file starting from the Core's <code>main</code>, and having features A and C also packaged/assembled, but not feature B and others.</p>

<p>While the JAR is launched, the <code>main</code> method should be able to know what features are installed and bootstrap them all, for eg.:</p>

<pre><code>main() {
  for(Runnable featureStarter : FeatureList.getFeatures()) { // Gets all features assembled by maven, which are now present in runtime
     featureStarter.run(); // Starts each feature
  }
}
</code></pre>

<p>or, a more rustic/hard-coded example (less preferred):</p>

<pre><code>main() {
  if(isInstalled("FeatureA"))
     FeatureA.start();

  if(isInstalled("FeatureB"))
     FeatureB.start();

  if(isInstalled("FeatureC"))
     FeatureC.start();

}
</code></pre>

<p>Is this somehow possible?</p>

<p>Thanks!</p>