in src/main/java/org/apache/sling/feature/maven/mojos/AttachFeatureArchivesMojo.java [83:117]
public void execute() throws MojoExecutionException, MojoFailureException {
checkPreconditions();
if (archives == null || archives.size() == 0) {
// by default create an archive of each feature individually
for (final Map.Entry<String, Feature> entry :
ProjectHelper.getFeatures(this.project).entrySet()) {
final boolean add;
if (ProjectHelper.isAggregate(entry.getKey())) {
add = ProjectHelper.isAttachAggregate(entry.getKey());
} else {
add = true;
}
if (add) {
final String classifier = entry.getValue().getId().getClassifier() == null
? DEFAULT_CLASSIFIER
: entry.getValue().getId().getClassifier().concat(DEFAULT_CLASSIFIER);
createArchive(
Collections.singletonList(entry.getValue()), classifier, Archive.DEFAULT_EXTENSION, true);
}
}
} else {
for (final Archive archive : archives) {
if (archive.getClassifier() == null) {
throw new MojoExecutionException("Classifier is missing for archive.");
}
if (archive.getType() == null) {
throw new MojoExecutionException("Type is missing for archive.");
}
final List<Feature> features = new ArrayList<>();
features.addAll(this.getSelectedFeatures(archive).values());
this.createArchive(features, archive.getClassifier(), archive.getType(), archive.attach);
}
}
}