Create a new format option for Maven Assembly plugin

681 views Asked by At

The Maven Assembly plugin allows different formats to be specified in the assembly descriptor. How can I develop a new format so it will be supported?

I would like to create an ISO image rather than a zip, jar or tar file that it already supports. I have found a plugin that will create an ISO image (https://github.com/stephenc/java-iso-tools), but not as part of the assembly plugin, so would be quite happy to make use of that, or even extend that plugin.

I basically want to be able to do the following in my assembly descriptor:

<assembly>
  <id>cd-image</id>
  <formats>
    <format>iso</format>
  </formats>
  <!-- Rest of descriptor here -->
</assembly>

I'd also like this to be able to remove the extra level of indirection within the created archive, so that when I declare that a file should be in the root of the archive it really is. This would be a tar bomb were it a tar file, but would be a useful feature for an ISO image.

2

There are 2 answers

0
khmarbaise On

The best thing is to file in issue in the issue tracking system: http://jira.codehaus.org/browse/MASSEMBLY furthermore to support this in a good way is to take a look into the source code of the maven-assembly-plugin and may be try to produce a patch which implements the functionality you like to have in it. But I doubt that it will accepted by the devs cause the tools you are referencing are GPL based software which can't be integrated in Apache licensed parts. So I wouldn't be astonished if they regret something like this. But may be I'm wrong. Just give it a try. Furthermore it might be a good idea to suggest a new Maven plugin which exactly is for such purpose (maven-iso-pugin?).

And very important you should check Maven Central, cause there exist a http://search.maven.org/#search|ga|1|iso9660-maven-plugin maven plugin for such purposes already.

0
James Marble On

The iso9660-maven-plugin (part of java-iso-tools) now supports this directly. You have to add it to your pom.xml as an extension and as a dependency to the maven-assembly-plugin:

    <build>
    <extensions>
        <extension> <!-- Adds "iso" as an assembly format. -->
            <groupId>com.github.stephenc.java-iso-tools</groupId>
            <artifactId>iso9660-maven-plugin</artifactId>
            <version>2.0.1</version>
        </extension>
    </extensions>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                       ...
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>com.github.stephenc.java-iso-tools</groupId>
                    <artifactId>iso9660-maven-plugin</artifactId>
                    <version>2.0.1</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

Then you can use <format>iso</format> in your assembly descriptor.

I see that the original asker was the one who added this capability to iso9660-maven-plugin. Thank you!