cziegeler commented on a change in pull request #49: Replacement PR for #41
with a clean set of changes
URL:
https://github.com/apache/sling-slingfeature-maven-plugin/pull/49#discussion_r379262608
##########
File path:
src/main/java/org/apache/sling/feature/maven/mojos/IncludeArtifactMojo.java
##########
@@ -119,4 +186,61 @@ private void includeArtifact(final Feature f, final
String extensionName, final
}
container.add(art);
}
+
+ private void installFMDescriptor(File file, Feature feature) {
+ Collection<org.apache.maven.artifact.Artifact> artifacts =
Collections.synchronizedCollection(new ArrayList<>());
+ if(file.exists() && file.canRead()) {
+ getLog().debug("FM File to be installed: " +
file.getAbsolutePath());
+ // Need to create a new Artifact Handler for the different
extension and an Artifact to not
+ // change the module artifact
+ DefaultArtifactHandler fmArtifactHandler = new
DefaultArtifactHandler("slingosgifeature");
+ ArtifactId artifactId = feature.getId();
+ DefaultArtifact fmArtifact = new DefaultArtifact(
+ artifactId.getGroupId(), artifactId.getArtifactId(),
artifactId.getVersion(),
+ null, "slingosgifeature", artifactId.getClassifier(),
fmArtifactHandler
+ );
+ fmArtifact.setFile(file);
+ artifacts.add(fmArtifact);
+ project.addAttachedArtifact(fmArtifact);
+ } else {
+ getLog().error("Could not find FM Descriptor File: " + file);
+ }
+ }
+
+ private void addDependencies(Feature feature) {
+ // Add Dependencies if configured so
+ for(String includeDependencyScope: includeDependenciesWithScope) {
+ List<Dependency> dependencies = project.getDependencies();
+ getLog().info("Project Dependencies: " + dependencies);
+ for(Dependency dependency: dependencies) {
+ if(includeDependencyScope.equals(dependency.getScope())) {
+ getLog().info("Include Artifact: " + dependencies);
+ ArtifactId id = new ArtifactId(
+ dependency.getGroupId(), dependency.getArtifactId(),
dependency.getVersion(), dependency.getClassifier(), dependency.getType()
+ );
+ Artifact artifact = new Artifact(id);
+ if(bundlesStartOrder >= 0) {
+ artifact.setStartOrder(bundlesStartOrder);
+ }
+ feature.getBundles().add(artifact);
+ }
+ }
+ }
+ }
+
+ private void includeFeatures(Map<String, Feature> selection, Feature
feature) {
Review comment:
The question is, do we need this at all? We have a mojo that is able to
aggregate, so you could first create the aggregation with the aggregate mojo
and have full control over how that is done and then you run the include mojo
and add the main artifact/dependencies.
You can also do it in reverse order, first use the include mojo and then
aggregate with other features.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services