Skip to content

Instantly share code, notes, and snippets.

@xnopre
Created November 28, 2012 21:39
Show Gist options
  • Save xnopre/4164769 to your computer and use it in GitHub Desktop.
Save xnopre/4164769 to your computer and use it in GitHub Desktop.
Ordered unpack dependencies with copy-maven-plugin
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xno</groupId>
<artifactId>test-unpack</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<unpackdir>${project.build.directory}/unpack</unpackdir>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.github.goldin</groupId>
<artifactId>copy-maven-plugin</artifactId>
<version>0.2.5</version>
<executions>
<execution>
<id>create-archive</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<resources>
<!-- Unzip ressources in desired order -->
<resource>
<targetPath>${unpackdir}</targetPath>
<dependencies>
<dependency>
<groupId>xno</groupId>
<artifactId>zip1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>zip</type>
<classifier>v2</classifier>
</dependency>
</dependencies>
<unpack>true</unpack>
</resource>
<resource>
<targetPath>${unpackdir}</targetPath>
<dependencies>
<dependency>
<groupId>xno</groupId>
<artifactId>zip1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>zip</type>
<classifier>aa</classifier>
</dependency>
</dependencies>
<unpack>true</unpack>
</resource>
<resource>
<targetPath>${unpackdir}</targetPath>
<dependencies>
<dependency>
<groupId>xno</groupId>
<artifactId>zip1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>zip</type>
<classifier>v1</classifier>
</dependency>
</dependencies>
<unpack>true</unpack>
</resource>
<!-- Create final ZIP -->
<resource>
<directory>${unpackdir}</directory>
<targetPath>${project.build.directory}/result.zip</targetPath>
<pack>true</pack>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment