<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<!--
See setup instructions.
http://www.perforce.com/perforce/doc.current/manuals/commons-admin/02_install.html#1123910
-->
<modelVersion>4.0.0</modelVersion>
<groupId>com.sonos.perforce</groupId>
<artifactId>commons</artifactId>
<version>7.0.47r14.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Perforce Commons - Apache Tomcat distributions</name>
<properties>
<!-- The version of commons.zip to pull off of ftp.perforce.com -->
<perforce.commons.version>r14.1</perforce.commons.version>
<!--
Is the directory *within* commons.zip in which the various WAR files reside.
We should really make this a regex expression but for now, it's good as a
rough draft.
-->
<perforce.commons.dir>commons-2014.1</perforce.commons.dir>
<!-- Version our Maven plug-ins with properties for easy upgrading -->
<version.maven-dependency-plugin>2.3</version.maven-dependency-plugin>
<version.maven-antrun-plugin>1.6</version.maven-antrun-plugin>
<version.maven-assembly-plugin>2.4</version.maven-assembly-plugin>
<!-- Which version of Apache Tomcat should we download -->
<version.tomcat>7.0.47</version.tomcat>
<tomcat.archive.file>${project.build.directory}/apache-tomcat-${version.tomcat}.tar.gz</tomcat.archive.file>
</properties>
<!--
Add your Maven repository information here if you wish to deploy these artifacts using the
Maven call 'deploy'
<distributionManagement>
<repository>
[ ... ]
</repository>
<snapshotRepository>
[ ... ]
</snapshotRepository>
</distributionManagement>
-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${version.maven-dependency-plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${version.maven-antrun-plugin}</version>
<executions>
<execution>
<id>repackage-tomcat</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Fetch the targeted version of Apache Tomcat -->
<get
src="http://archive.apache.org/dist/tomcat/tomcat-7/v${version.tomcat}/bin/apache-tomcat-${version.tomcat}.zip"
dest="${project.build.directory}"
verbose="false"
usetimestamp="false"
/>
<!-- Fetch the targeted version of Perforce Commons -->
<get
src="ftp://ftp.perforce.com/perforce/${perforce.commons.version}/bin.java/commons.zip"
dest="${project.build.directory}"
verbose="false"
usetimestamp="false"
/>
<!-- Unzip Perforce Commons -->
<unzip
src="target/commons.zip"
dest="${project.build.directory}"
/>
<gunzip
src="${basedir}/target/apache-tomcat-${version.tomcat}.tar.gz"
dest="${project.build.directory}"
/>
<untar
src="${basedir}/target/apache-tomcat-${version.tomcat}.tar"
dest="${project.build.directory}">
<patternset>
<exclude name="apache-tomcat-${version.tomcat}/webapps/**" />
</patternset>
</untar>
<mkdir dir="${project.build.directory}/war" />
<copy todir="${project.build.directory}/war" flatten="true">
<fileset dir="${project.build.directory}/${perforce.commons.dir}">
<include name="**/*.war" />
</fileset>
<chainedmapper>
<flattenmapper />
<regexpmapper from="^([A-Za-z0-9]+)\-(.*).war$$" to="\1.war" />
</chainedmapper>
</copy>
<!-- Patch the bin/catalina* scripts to include some of our jars in the classpath -->
<!-- ... Some more magic goes on here ... -->
<!-- Remove the default webapps -->
</target>
</configuration>
</execution>
</executions>
</plugin>
<!--
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${tomcat.archive.file}</file>
<type>tar.gz</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
-->
</plugins>
</build>
<profiles>
<profile>
<id>commons</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${version.maven-antrun-plugin}</version>
<executions>
<execution>
<id>commons-prepare</id>
<phase>initialize</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Extracting ${project.build.directory}/war/commons.war" />
<unzip
src="${project.build.directory}/war/commons.war"
dest="${project.build.directory}/war/commons_war"
/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${version.maven-assembly-plugin}</version>
<executions>
<execution>
<id>commons-package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>perforce-commons-${project.version}</finalName>
<filters>
<filter>src/main/assembly/filter.properties</filter>
</filters>
<descriptors>
<descriptor>src/main/assembly/commons.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>p4combine</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${version.maven-antrun-plugin}</version>
<executions>
<execution>
<id>p4combine-prepare</id>
<phase>initialize</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Extracting ${project.build.directory}/war/p4combine.war" />
<unzip
src="${project.build.directory}/war/p4combine.war"
dest="${project.build.directory}/war/p4combine_war"
/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${version.maven-assembly-plugin}</version>
<executions>
<execution>
<id>p4combine-package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>perforce-p4combine-${project.version}</finalName>
<filters>
<filter>src/main/assembly/filter.properties</filter>
</filters>
<descriptors>
<descriptor>src/main/assembly/p4combine.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>p4preview</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${version.maven-antrun-plugin}</version>
<executions>
<execution>
<id>p4preview-prepare</id>
<phase>initialize</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Extracting ${project.build.directory}/war/p4preview.war" />
<unzip
src="${project.build.directory}/war/p4preview.war"
dest="${project.build.directory}/war/p4preview_war"
/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${version.maven-assembly-plugin}</version>
<executions>
<execution>
<id>p4preview-package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>perforce-p4preview-${project.version}</finalName>
<filters>
<filter>src/main/assembly/filter.properties</filter>
</filters>
<descriptors>
<descriptor>src/main/assembly/p4preview.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>pdfcompare</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${version.maven-antrun-plugin}</version>
<executions>
<execution>
<id>pdfcompare-prepare</id>
<phase>initialize</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Extracting ${project.build.directory}/war/pdfcompare.war" />
<unzip
src="${project.build.directory}/war/pdfcompare.war"
dest="${project.build.directory}/war/pdfcompare_war"
/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${version.maven-assembly-plugin}</version>
<executions>
<execution>
<id>pdfcompare-package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>perforce-pdfcompare-${project.version}</finalName>
<filters>
<filter>src/main/assembly/filter.properties</filter>
</filters>
<descriptors>
<descriptor>src/main/assembly/pdfcompare.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>