Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven assembly plugin - multiple descriptors?

The goal is to create a single ZIP file, but split the configuration of the Maven Assembly plugin into a general and more specific descriptor.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>3.0.0</version>
    <configuration>
        <descriptors>
            <descriptor>${project.basedir}/../src/assembly/rest-executables.xml</descriptor>
            <descriptor>${project.basedir}/../../src/assembly/deliverables.xml</descriptor>
        </descriptors>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>

However, when the two custom descriptors have unique IDs, two ZIP files are created - each with the expected contents. When the IDs are identical, only the last descriptor is executed (or it overwrites the previous contents).

Is what I'm attempting not possible or am I missing an option somewhere like 'append to existing ZIP' rather than 'always create new ZIP'?

like image 257
morsor Avatar asked Nov 27 '25 01:11

morsor


2 Answers

Component Descriptors is definitely the way to go. Yes, I am pulling from the comments, but that is because the accepted answer did not work and I wanted to highlight what @user944849 said. The accepted answer doesn't actually make a difference to the maven assembly plugin, it is just a different way to convey multiple descriptors.

Component Descriptors however, allow you to define a "component" that can be used in an assembly. So you can define a common set of files, without having to copy and paste all of them into different assemblies.

like image 91
wrestang Avatar answered Nov 29 '25 17:11

wrestang


I was able to fix it by for removing inner descriptor tags

<configuration>
    <descriptors>${project.basedir}/../src/assembly/rest-executables.xml,${project.basedir}/../../src/assembly/deliverables.xml</descriptors>
</configuration>
like image 22
Mike Avatar answered Nov 29 '25 17:11

Mike



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!