Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-9656

gracefully handle scenarios where the AggregateFeaturesMojo gets invoked more than once during the build

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • slingfeature-maven-plugin 1.3.6
    • None
    • None

    Description

      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:

      org-apache-sling-launchpad-testing $ mvn clean eclipse:eclipse verify

       
      Results in this error:

      [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]

       
      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:

      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

      [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

      Attachments

        Issue Links

          Activity

            People

              enorman Eric Norman
              enorman Eric Norman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: