diff --git a/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/AbstractTychoPackagingMojo.java b/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/AbstractTychoPackagingMojo.java index f824ead9dd..2dd726fda8 100644 --- a/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/AbstractTychoPackagingMojo.java +++ b/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/AbstractTychoPackagingMojo.java @@ -69,6 +69,29 @@ public abstract class AbstractTychoPackagingMojo extends AbstractMojo { @Parameter(defaultValue = "true") protected boolean strictBinIncludes; + /** + * Additional files to be included in the final .jar. + *

+ * A typical usage might be when bin.includes in build.properties + * is not flexible enough, e.g., for generated files, as when conflicting additional files + * win over bin.includes. + *

+ * Example: + *

+     * <additionalFileSets>
+     *  <fileSet>
+     *   <directory>${project.build.directory}/mytool-gen/</directory>
+     *   <includes>
+     *    <include>**/*</include>
+     *   </includes>
+     *  </fileSet>
+     * </additionalFileSets>
+     * 
+ * Note: currently, additional file sets are not used for the package-iu goal. + */ + @Parameter + protected DefaultFileSet[] additionalFileSets; + @Component protected PlexusContainer plexus; diff --git a/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackageFeatureMojo.java b/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackageFeatureMojo.java index 99c5ed067a..c4c393f64c 100644 --- a/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackageFeatureMojo.java +++ b/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackageFeatureMojo.java @@ -168,6 +168,18 @@ public void execute() throws MojoExecutionException, MojoFailureException { jarArchiver.setDestFile(outputJar); try { + // Additional file sets win over bin.includes ones, so we add them first + if (additionalFileSets != null) { + for (final var fileSet : additionalFileSets) { + final var directory = fileSet.getDirectory(); + + // noinspection ConstantConditions + if (directory != null && directory.isDirectory()) { + archiver.getArchiver().addFileSet(fileSet); + } + } + } + archiver.getArchiver().addFileSet(getManuallyIncludedFiles(buildProperties)); if (licenseFeature != null) { archiver.getArchiver() diff --git a/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackagePluginMojo.java b/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackagePluginMojo.java index 073272b619..5ac3b6473d 100644 --- a/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackagePluginMojo.java +++ b/tycho-packaging-plugin/src/main/java/org/eclipse/tycho/packaging/PackagePluginMojo.java @@ -71,28 +71,6 @@ public class PackagePluginMojo extends AbstractTychoPackagingMojo { @Component(role = Archiver.class, hint = "jar") private JarArchiver jarArchiver; - /** - * Additional files to be included in the bundle jar. This can be used when - * bin.includes in build.properties is not flexible enough , e.g. for - * generated files. If conflicting, additional files win over - * bin.includes
- * Example:
- * - *
-	 * <additionalFileSets>
-	 *  <fileSet>
-	 *   <directory>${project.build.directory}/mytool-gen/</directory>
-	 *   <includes>
-	 *    <include>**/*</include>
-	 *   </includes>
-	 *  </fileSet>     
-	 * </additionalFileSets>
-	 * 
- * - */ - @Parameter - private DefaultFileSet[] additionalFileSets; - /** * Name of the generated JAR. */