<?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">
	<modelVersion>4.0.0</modelVersion>
	<description>PDFsam App</description>
	<url>http://www.pdfsam.org</url>
	<parent>
		<groupId>org.pdfsam</groupId>
		<artifactId>pdfsam-parent</artifactId>
		<version>3.3.2</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<artifactId>pdfsam-community</artifactId>
	<packaging>jar</packaging>
	<name>PDFsam Community Edition application</name>

	<issueManagement>
		<system>GitHub</system>
		<url>https://github.com/torakiki/pdfsam/issues</url>
	</issueManagement>

	<licenses>
		<license>
			<name>GNU Affero General Public License</name>
			<url>http://www.gnu.org/licenses/agpl-3.0.html</url>
			<distribution>repo</distribution>
			<comments>AGPLv3</comments>
		</license>
	</licenses>

	<profiles>
		<profile>
			<id>release</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-shade-plugin</artifactId>
						<executions>
							<execution>
								<phase>package</phase>
								<goals>
									<goal>shade</goal>
								</goals>
								<configuration>
									<createDependencyReducedPom>false</createDependencyReducedPom>
									<transformers>
										<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
											<mainClass>org.pdfsam.community.App</mainClass>
											<manifestEntries>
												<Class-Path>etc/</Class-Path>
												<SplashScreen-Image>images/community/splash.gif</SplashScreen-Image>
											</manifestEntries>
										</transformer>
									</transformers>
									<filters>
										<filter>
											<artifact>*:*</artifact>
											<excludes>
												<exclude>META-INF/*.SF</exclude>
												<exclude>META-INF/*.DSA</exclude>
												<exclude>META-INF/*.RSA</exclude>
												<exclude>META-INF/NOTICE*</exclude>
												<exclude>META-INF/notice*</exclude>
												<exclude>META-INF/LICENSE*</exclude>
												<exclude>META-INF/license*</exclude>
												<exclude>META-INF/DEPENDENCIES*</exclude>
												<exclude>license/*</exclude>
											</excludes>
										</filter>
									</filters>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<version>1.9.1</version>
						<executions>
							<execution>
								<id>parse-version</id>
								<phase>package</phase>
								<goals>
									<goal>parse-version</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>com.akathist.maven.plugins.launch4j</groupId>
						<artifactId>launch4j-maven-plugin</artifactId>
						<version>1.7.15</version>
						<executions>
							<execution>
								<id>exe-creation</id>
								<phase>package</phase>
								<goals>
									<goal>launch4j</goal>
								</goals>
								<configuration>
									<headerType>gui</headerType>
									<outfile>${project.build.directory}/pdfsam.exe</outfile>
									<jar>${project.build.finalName}.jar</jar>
									<dontWrapJar>true</dontWrapJar>
									<icon>src/assembly/resources/pdfsam.ico</icon>
									<errTitle>Cannot find Java Runtime Environment</errTitle>
									<jre>
										<path>%PDFSAM_JAVA_PATH%</path>
										<minVersion>1.8.0</minVersion>
									</jre>
									<versionInfo>
										<fileVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.0</fileVersion>
										<txtFileVersion>${project.version}</txtFileVersion>
										<fileDescription>PDFsam Basic</fileDescription>
										<copyright>Andrea Vacondio 2015</copyright>
										<productVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.0</productVersion>
										<txtProductVersion>${project.version}</txtProductVersion>
										<productName>PDF Split And Merge Basic Edition</productName>
										<internalName>PDFsam</internalName>
										<originalFilename>pdfsam.exe</originalFilename>
										<language>
											ENGLISH_US
										</language>
									</versionInfo>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-resources-plugin</artifactId>
						<executions>
							<execution>
								<id>copy-resources</id>
								<phase>package</phase>
								<goals>
									<goal>copy-resources</goal>
								</goals>
								<configuration>
									<outputDirectory>${project.build.directory}/assembled</outputDirectory>
									<resources>
										<resource>
											<directory>${basedir}</directory>
											<includes>
												<include>
													LICENSE.txt
												</include>
											</includes>
										</resource>
										<resource>
											<directory>${basedir}/doc</directory>
											<targetPath>${project.build.directory}/assembled/doc</targetPath>
										</resource>
										<resource>
											<directory>${basedir}/src/main/resources/images/community</directory>
											<targetPath>${project.build.directory}/assembled/resources</targetPath>
											<includes>
												<include>
													splash.gif
												</include>
											</includes>
										</resource>
										<resource>
											<directory>${basedir}/src/assembly/resources</directory>
											<includes>
												<include>
													pdfsam.l4j.ini
												</include>
											</includes>
										</resource>
										<resource>
											<directory>${project.build.directory}</directory>
											<includes>
												<include>
													pdfsam.exe
												</include>
												<include>
													${project.build.finalName}.${project.packaging}
												</include>
											</includes>
										</resource>
										<resource>
											<targetPath>${project.build.directory}/assembled/bin</targetPath>
											<directory>${basedir}/src/assembly/resources/bin</directory>
											<filtering>true</filtering>
										</resource>
										<resource>
											<targetPath>${project.build.directory}/assembled/etc</targetPath>
											<directory>${basedir}/src/main/etc</directory>
											<filtering>false</filtering>
										</resource>
									</resources>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-assembly-plugin</artifactId>
						<executions>
							<execution>
								<id>pdfsam-assembly</id>
								<phase>package</phase>
								<goals>
									<goal>single</goal>
								</goals>
								<configuration>
									<finalName>pdfsam-${project.version}</finalName>
									<descriptors>
										<descriptor>src/assembly/bin.xml</descriptor>
									</descriptors>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>jdeb</artifactId>
						<groupId>org.vafer</groupId>
						<version>1.5</version>
						<executions>
							<execution>
								<phase>package</phase>
								<goals>
									<goal>jdeb</goal>
								</goals>
								<configuration>
									<deb>[[buildDir]]/pdfsam_[[version]]-1_all.[[extension]]</deb>
									<dataSet>
										<data>
											<src>${project.build.directory}/assembled/bin/pdfsam.sh</src>
											<dst>/opt/pdfsam-basic/bin/pdfsam-basic</dst>
											<type>file</type>
											<mapper>
												<type>perm</type>
												<filemode>755</filemode>
											</mapper>
										</data>
										<data>
											<src>${project.build.directory}/assembled</src>
											<type>directory</type>
											<excludes>pdfsam.exe,pdfsam.l4j.ini,bin/pdfsam.sh,bin/pdfsam.bat</excludes>
											<mapper>
												<type>perm</type>
												<prefix>/opt/pdfsam-basic</prefix>
												<filemode>644</filemode>
												<dirmode>755</dirmode>
											</mapper>
										</data>
										<data>
											<type>link</type>
											<linkName>/usr/bin/pdfsam</linkName>
											<linkTarget>/opt/pdfsam-basic/bin/pdfsam-basic</linkTarget>
											<symlink>true</symlink>
											<mapper>
												<type>perm</type>
												<filemode>755</filemode>
											</mapper>
										</data>
										<data>
											<src>${project.basedir}/src/deb/doc/changelog.Debian.gz</src>
											<dst>/usr/share/doc/pdfsam-basic/changelog.Debian.gz</dst>
											<type>file</type>
										</data>
										<data>
											<src>${project.basedir}/src/deb/doc/copyright</src>
											<dst>/usr/share/doc/pdfsam-basic/copyright</dst>
											<type>file</type>
										</data>
										<data>
											<src>${project.basedir}/src/deb/pdfsam-basic.desktop</src>
											<dst>/usr/share/applications/pdfsam-basic.desktop</dst>
											<type>file</type>
										</data>
										<data>
											<src>${project.basedir}/src/deb/icon.svg</src>
											<dst>/opt/pdfsam-basic/icon.svg</dst>
											<type>file</type>
										</data>
										<data>
											<src>doc</src>
											<type>directory</type>
											<mapper>
												<type>perm</type>
												<prefix>/opt/pdfsam-basic/doc</prefix>
												<filemode>644</filemode>
												<dirmode>755</dirmode>
											</mapper>
										</data>
									</dataSet>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<properties>
		<pdfsam.package>COMMUNITY</pdfsam.package>
	</properties>

	<build>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
				<includes>
					<include>**/*.properties</include>
				</includes>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>false</filtering>
				<excludes>
					<exclude>**/*.properties</exclude>
				</excludes>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>1.3.2</version>
				<executions>
					<execution>
						<goals>
							<goal>java</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<includeProjectDependencies>true</includeProjectDependencies>
					<additionalClasspathElements>
						<additionalClasspathElement>src/main/etc-dev</additionalClasspathElement>
					</additionalClasspathElements>
					<mainClass>org.pdfsam.community.App</mainClass>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
		</dependency>
		<dependency>
			<groupId>org.sejda</groupId>
			<artifactId>eventstudio</artifactId>
		</dependency>
		<dependency>
			<groupId>org.pdfsam</groupId>
			<artifactId>pdfsam-gui</artifactId>
			<version>${project.version}</version>
			<exclusions>
				<exclusion>
					<artifactId>commons-logging</artifactId>
					<groupId>commons-logging</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<version>${logback.version}</version>
		</dependency>
		<dependency>
			<groupId>org.sejda</groupId>
			<artifactId>sejda-injector</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
		</dependency>
		<!-- test dependencies -->
		<dependency>
			<groupId>jdepend</groupId>
			<artifactId>jdepend</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>
