[ 
https://issues.apache.org/jira/browse/SLING-9656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17201725#comment-17201725
 ] 

Eric Norman commented on SLING-9656:
------------------------------------

[~rombert] / [~cziegeler] - Thanks for reviewing and I see your points.  Well, 
since this mojo is about to add (or replace?) the aggregate feature in the 
project features map anyways, how would you feel about just removing the 
previous equivalent entry from those maps before we attempt to validate?

I've update the PR with that approach.  Please review and provide your feedback.

> gracefully handle scenarios where the AggregateFeaturesMojo gets invoked more 
> than once during the build
> --------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-9656
>                 URL: https://issues.apache.org/jira/browse/SLING-9656
>             Project: Sling
>          Issue Type: Bug
>    Affects Versions: slingfeature-maven-plugin 1.3.6
>            Reporter: Eric Norman
>            Priority: Major
>
> If I combine the "eclipse:eclipse" goal with the "install" or "verify" goal 
> in the same mvn command line, it results in an error about a duplicate 
> feature file.   The "aggregate-features" goal is getting called twice during 
> this build scenario and not handling it well.
>  
> For example:
> {quote}_org-apache-sling-launchpad-testing $_ *mvn clean eclipse:eclipse 
> verify*{quote}
>  
> Results in this error:
> {quote}{color:#ff0000}[ERROR] Failed to execute goal 
> org.apache.sling:slingfeature-maven-plugin:1.3.6:aggregate-features 
> (aggregate-features) on project org.apache.sling.launchpad.testing: Execution 
> aggregate-features of goal 
> org.apache.sling:slingfeature-maven-plugin:1.3.6:aggregate-features failed: 
> More than one feature file for classifier testing-oak_tar in project 
> org.apache.sling:org.apache.sling.launchpad.testing:jar:12-SNAPSHOT : 
> [aggregate testing-oak_tar, aggregate testing-oak_tar] -> [Help 
> 1]{color}{quote}
>  
> A workaround is to run the "eclipse:eclipse" goal and the "install" or 
> "verify goal in separate runs.
> Additional info from [~rombert] from the mailing list is below:
> {quote}Why this happens:
> - the eclipse:eclipse invocation invokes the lifecycle phase generate-
> resources [5]
> - the AggregateFeaturesMojo is bound to the generate-resources phase as
> well [6]
> - when running `mvn clean eclipse:eclipse install` the generate-
> resources phase is invoked twice, and it seems that the features are
> aggregated twice
> I think the most reasonable solution would be for the slingfeature-
> maven-plugin to handle this gracefully, as it fails also when executing
> $ mvn generate-resources generate-resources
> {quote}
> {quote}[5]: 
> [https://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html]
> [6]: 
> [https://github.com/apache/sling-slingfeature-maven-plugin/blob/6d2918f1c0e8b3162a826149e9ba4bfd475c9216/src/main/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojo.java#L47-L51]
> {quote}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to