Search code examples
mavenmaven-assembly-plugin

Maven assembly plug-in - how to produce artifact with custom file extension?


I am producing an artifact named foo.bar.zip from the following...

My pom.xml plug-in entry looks like this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
        <descriptor>src/assembly/bin.xml</descriptor>
        <finalName>foo.bar</finalName>
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
        </execution>
    </executions>
</plugin> 

My descriptor file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<formats>
    <format>zip</format>
</formats>
<fileSets>

etc. etc. 

My question, is how do I produce a file with a custom extension? E.g. with the name foo.bar instead of foo.bar.zip.


Solution

  • Assembly supports just these formats:

    "zip" - Creates a ZIP file format

    "tar" - Creates a TAR format

    "tar.gz" or "tgz" - Creates a gzip'd TAR format

    "tar.bz2" or "tbz2" - Creates a bzip'd TAR format

    "jar" - Creates a JAR format

    "dir" - Creates an exploded directory format

    "war" - Creates a WAR format

    You should consider to use antrun plugin in a later goal/phase to rename file extension