Skip to content
pom.xml 10 KiB
Newer Older
Patrik Dufresne's avatar
Patrik Dufresne committed
<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>
	<parent>
Patrik Dufresne's avatar
Patrik Dufresne committed
		<groupId>com.patrikdufresne</groupId>
		<artifactId>planimod-parent</artifactId>
		<version>${revision}</version>
Patrik Dufresne's avatar
Patrik Dufresne committed
	<artifactId>planimod-installation-package</artifactId>
	<packaging>pom</packaging>
	<properties>
		<deploy.ssh.hostname>patrikdufresne.com</deploy.ssh.hostname>
		<deploy.ssh.username>maven</deploy.ssh.username>
		<deploy.ssh.keyfile>${user.home}/.ssh/id_rsa</deploy.ssh.keyfile>
		<deploy.ssh.tracenv>/srv/trac/planimod</deploy.ssh.tracenv>
	</properties>
	<build>
		<plugins>
			<!--Generate the shell script to start the application from command line -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>appassembler-maven-plugin</artifactId>
				<version>1.3.1</version>
				<executions>
					<execution>
						<id>assemble-standalone</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>assemble</goal>
						</goals>
						<configuration>
							<assembleDirectory>${project.build.directory}/package</assembleDirectory>
							<programs>
								<program>
									<mainClass>com.planimod.ui.Main</mainClass>
									<name>planimod</name>
								</program>
							</programs>
							<platforms>
								<platform>unix</platform>
							</platforms>
							<repositoryLayout>flat</repositoryLayout>
							<repositoryName>lib</repositoryName>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- Copy SWT jars for supported platform. -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>2.7</version>
				<executions>
					<execution>
						<id>copy-swt-win-x86</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>copy</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>org.eclipse.swt</groupId>
									<artifactId>org.eclipse.swt.win32.win32.x86</artifactId>
								</artifactItem>
							</artifactItems>
							<outputDirectory>${project.build.directory}/package/lib/win/x86</outputDirectory>
						</configuration>
					</execution>
					<execution>
						<id>copy-swt-win-x86-64</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>copy</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>org.eclipse.swt</groupId>
									<artifactId>org.eclipse.swt.win32.win32.x86_64</artifactId>
								</artifactItem>
							</artifactItems>
							<outputDirectory>${project.build.directory}/package/lib/win/x86_64</outputDirectory>
						</configuration>
					</execution>
Patrik Dufresne's avatar
Patrik Dufresne committed
					<!-- Extract icons -->
Patrik Dufresne's avatar
Patrik Dufresne committed
						<id>unpack-icons</id>
Patrik Dufresne's avatar
Patrik Dufresne committed
							<goal>unpack</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
Patrik Dufresne's avatar
Patrik Dufresne committed
									<groupId>com.patrikdufresne</groupId>
									<artifactId>planimod-icons</artifactId>
									<version>${project.version}</version>
Patrik Dufresne's avatar
Patrik Dufresne committed
							<outputDirectory>${project.build.directory}/generated-resources/icons</outputDirectory>
Patrik Dufresne's avatar
Patrik Dufresne committed

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
Patrik Dufresne's avatar
Patrik Dufresne committed
				<!-- Copy /src/main/root into /target/package -->
				<executions>
					<execution>
						<id>copy-root-resources</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<resources>
								<resource>
									<filtering>false</filtering>
									<directory>src/main/root</directory>
								</resource>
							</resources>
							<outputDirectory>${project.build.directory}/package</outputDirectory>
							<filtering>false</filtering>
						</configuration>
					</execution>
Patrik Dufresne's avatar
Patrik Dufresne committed
					<!-- Copy icons into /target/package -->
					<execution>
						<id>copy-icons-resources</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<resources>
								<resource>
									<filtering>false</filtering>
									<directory>${project.build.directory}/generated-resources/icons/com/planimod/ui/theme</directory>
								</resource>
							</resources>
							<outputDirectory>${project.build.directory}/package</outputDirectory>
							<filtering>false</filtering>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- Create an archive for linux from /package -->
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.2-beta-2</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
						<configuration>
							<descriptors>
								<descriptor>src/main/assembly/linux-package.xml</descriptor>
							</descriptors>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>1.7</version>
				<executions>
Patrik Dufresne's avatar
Patrik Dufresne committed
					<!-- Create a single Windows Installer (32bits & 64 bits) -->
Patrik Dufresne's avatar
Patrik Dufresne committed
						<id>package-win</id>
Patrik Dufresne's avatar
Patrik Dufresne committed

								<!-- Import Ant contrib. -->
								<taskdef resource="net/sf/antcontrib/antlib.xml"
									classpathref="maven.plugin.classpath" />

								<!-- Declare signexe macro. -->
								<macrodef name="signexe">
									<attribute name="osslsigncode-path"
										default="osslsigncode" />
									<attribute name="certs-file" />
									<attribute name="key-file" />
									<attribute name="passphrase" />
									<attribute name="hash" default="sha2" />
									<attribute name="name" default="${project.name}" />
									<attribute name="url" default="${project.url}" />
									<attribute name="file" />
									<attribute name="if" default="true" />
									<sequential>
										<if>
											<isset property="@{if}" />
											<then>
												<move file="@{file}" tofile="@{file}.unsigned" />
												<echo message="Sign @{file}" />
												<exec executable="@{osslsigncode-path}"
													dir="${project.build.directory}" failonerror="true">
													<arg value="-certs" />
													<arg value="@{certs-file}" />
													<arg value="-key" />
													<arg value="@{key-file}" />
													<arg value="-pass" />
													<arg value="@{passphrase}" />
													<arg value="-n" />
													<arg value="@{name}" />
													<arg value="-i" />
													<arg value="@{url}" />
													<arg value="-h" />
													<arg value="@{hash}" />
													<arg value="-t" />
													<arg
														value="http://timestamp.verisign.com/scripts/timstamp.dll" />
													<arg value="-in" />
													<arg value="@{file}.unsigned" />
													<arg value="-out" />
													<arg value="@{file}" />
												</exec>
												<delete file="@{file}.unsigned" />
											</then>
										</if>
									</sequential>
								</macrodef>

								<!-- Sign winrun4j exe -->
								<signexe certs-file="${sign.certs.path}"
									key-file="${sign.key.path}" passphrase="${sign.passphrase}"
									name="Planimod"
									file="${project.build.directory}/package/bin/planimod.exe"
									if="sign.key.path" />
								<signexe certs-file="${sign.certs.path}"
									key-file="${sign.key.path}" passphrase="${sign.passphrase}"
									name="Planimod"
									file="${project.build.directory}/package/bin/planimod64.exe"
									if="sign.key.path" />

								<!-- Convert the license file into Window encoding -->
								<copy file="${basedir}/../LICENSE"
Patrik Dufresne's avatar
Patrik Dufresne committed
									tofile="${project.build.directory}/package/LICENSE.txt"
									encoding="UTF-8" outputencoding="ISO-8859-1" />
								<copy file="${basedir}/../LICENSE.fr"
									tofile="${project.build.directory}/package/LICENSE.fr.txt"
									encoding="UTF-8" outputencoding="ISO-8859-1" />
Patrik Dufresne's avatar
Patrik Dufresne committed

								<propertyregex property="AppVersion"
									input="0.0.0.${project.version}"
									regexp=".*([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)" select="\1" />
								<exec osfamily="unix" executable="makensis"
									dir="${project.build.directory}/package" failonerror="true">
									<!-- Avoid changing working directory -->
									<arg value="-NOCD" />
Patrik Dufresne's avatar
Patrik Dufresne committed
									<arg value="-Dincludedir=${basedir}/src/main/nsis/include" />
									<arg value="-Dplugindir=${basedir}/src/main/nsis/plugin" />
									<arg value="-DAppVersion=${AppVersion}" />
									<arg value="${basedir}/src/main/nsis/setup.nsi" />
								</exec>
Patrik Dufresne's avatar
Patrik Dufresne committed
								<move file="${project.build.directory}/package/setup.exe"
									tofile="${project.build.directory}/planimod-${project.version}-install.exe" />

								<!-- Sign exe installer -->
								<signexe certs-file="${sign.certs.path}"
									key-file="${sign.key.path}" passphrase="${sign.passphrase}"
									name="Planimod Installer"
									file="${project.build.directory}/planimod-${project.version}-install.exe"
									if="sign.key.path" />

							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
Patrik Dufresne's avatar
Patrik Dufresne committed
				<dependencies>
					<dependency>
						<groupId>ant-contrib</groupId>
						<artifactId>ant-contrib</artifactId>
						<version>1.0b3</version>
						<exclusions>
							<exclusion>
								<groupId>ant</groupId>
								<artifactId>ant</artifactId>
							</exclusion>
						</exclusions>
					</dependency>
					<dependency>
						<groupId>org.apache.ant</groupId>
						<artifactId>ant-nodeps</artifactId>
						<version>1.8.1</version>
					</dependency>
				</dependencies>
Patrik Dufresne's avatar
Patrik Dufresne committed
			<groupId>com.patrikdufresne</groupId>
			<artifactId>planimod</artifactId>
			<version>${project.version}</version>