Skip to content

Instantly share code, notes, and snippets.

@asaikali
Created June 29, 2013 02:10
Show Gist options
  • Select an option

  • Save asaikali/5889375 to your computer and use it in GitHub Desktop.

Select an option

Save asaikali/5889375 to your computer and use it in GitHub Desktop.
maven assembly plugin fun
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>linux</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<files>
<file>
<source>${project.basedir}/src/main/config/config.properties</source>
</file>
</files>
<fileSets>
<fileSet>
<directory>${project.basedir}/src/main/scripts</directory>
<outputDirectory>/</outputDirectory>
<excludes>
<exclude>*.bat</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/dependency/apache-tomcat-${tomcat.version}</directory>
<outputDirectory>/tomcat</outputDirectory>
<excludes>
<exclude>**/webapps/**</exclude>
<exclude>**/bin/*.bat</exclude>
<exclude>**/bin/catalina-tasks.xml</exclude>
<exclude>**/lib/tomcat-i18n-*.jar</exclude>
<exclude>**/conf/tomcat-users.xml</exclude>
</excludes>
</fileSet>
</fileSets>
<!--
<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<unpack>true</unpack>
<includes>
<include>org.apache.tomcat:tomcat:tar.gz:*</include>
</includes>
<unpackOptions>
<excludes>
<exclude>**/webapps/**</exclude>
<exclude>**/bin/*.bat</exclude>
<exclude>**/lib/tomcat-i18n-*.jar</exclude>
<exclude>**/conf/tomcat-users.xml</exclude>
</excludes>
</unpackOptions>
<outputDirectory>/tomcat</outputDirectory>
</dependencySet>
</dependencySets>
-->
</assembly>
<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>com.example</groupId>
<artifactId>tomcat</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<tomcat.version>7.0.41</tomcat.version>
<tomcat.dir>${project.build.directory}/dependency/apache-tomcat-${tomcat.version}</tomcat.dir>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>${tomcat.version}</version>
<type>tar.gz</type>
</dependency>
<dependency>
<groupId>commons-daemon</groupId>
<artifactId>commons-daemon</artifactId>
<version>1.0.15</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>snaps</id>
<url>http://localhost:8082/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<profiles>
<profile>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>compile-jsvc</id>
<phase>prepare-package</phase>
<configuration>
<tasks>
<echo> this is a test ${os.name} </echo>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>unpack-tomcat</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>${tomcat.version}</version>
<type>tar.gz</type>
<overWrite>true</overWrite>
<excludes>**/webapps/**</excludes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>create-linux-distribution</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptor>src/main/assembly/example-linux.xml</descriptor>
</configuration>
</execution>
<!-- <execution> <id>create-windows-distributionr</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <descriptor>src/main/assembly/example-win.xml</descriptor>
</configuration> </execution> -->
</executions>
</plugin>
</plugins>
</build>
</project>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment