I have a project with the following conceptual structure:
-- Core project: Contains the main() function
---- Feature A
---- Feature B
---- Feature C
---- etc.
I am looking for a way to tell maven the following:
mvn package core--with--featureA--and--featureC
This example would create an executable JAR file starting from the Core's main
, and having features A and C also packaged/assembled, but not feature B and others.
While the JAR is launched, the main
method should be able to know what features are installed and bootstrap them all, for eg.:
main() {
for(Runnable featureStarter : FeatureList.getFeatures()) { // Gets all features assembled by maven, which are now present in runtime
featureStarter.run(); // Starts each feature
}
}
or, a more rustic/hard-coded example (less preferred):
main() {
if(isInstalled("FeatureA"))
FeatureA.start();
if(isInstalled("FeatureB"))
FeatureB.start();
if(isInstalled("FeatureC"))
FeatureC.start();
}
Is this somehow possible?
Thanks!