<?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/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>de.lmu.ifi.dbs.elki</groupId>
		<version>0.7.1</version>
		<artifactId>elki-project</artifactId>
		<relativePath>../..</relativePath>
	</parent>

	<artifactId>elki-bundle</artifactId>
	<packaging>jar</packaging>

	<name>ELKI Data Mining Framework - Single-jar Bundle</name>

	<url>http://elki.dbs.ifi.lmu.de/</url>
	<issueManagement>
		<url>http://elki.dbs.ifi.lmu.de/newticket</url>
	</issueManagement>
	<licenses>
		<license>
			<name>GNU Affero General Public License (AGPL) version 3.0</name>
			<url>http://www.gnu.org/licenses/agpl-3.0.txt</url>
		</license>
	</licenses>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<elki.projdir>${basedir}/../..</elki.projdir>
	</properties>

	<dependencies>
		<!-- assembly descriptors will reference this dependencies -->
		<dependency>
			<groupId>${project.groupId}</groupId>
			<artifactId>elki</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>${project.groupId}</groupId>
			<artifactId>elki-libsvm</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>${project.groupId}</groupId>
			<artifactId>elki-batik-visualization</artifactId>
			<version>${project.version}</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<!-- Ensure the directory exists, for code below. -->
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<id>createJavadocDir</id>
						<phase>compile</phase><!-- abuse compile to run before prepare-package -->
						<configuration>
						<target>
								<mkdir dir="${project.build.directory}/apidocs" />
						</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<!-- Copy dependencies earlier: -->
			<plugin>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>compile</phase> <!-- abuse compile to run before prepare-package -->
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${outputDir}</outputDirectory>
							<excludeArtifactIds>junit:*,org.hamcrest:*</excludeArtifactIds>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- Extract (and rename) licensing information; build additional documentation -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>build-legal</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>exec</goal>
						</goals>
						<configuration>
							<executable>python</executable>
							<arguments>
								<argument>${basedir}/install-licenses.py</argument>
								<argument>${project.build.directory}/classes</argument>
								<argument>${project.build.directory}/dependency</argument>
							</arguments>
						</configuration>
					</execution>
					<execution>
						<id>generate-javadoc-parameters</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>exec</goal>
						</goals>
						<configuration>
							<executable>java</executable>
							<arguments>
								<!-- <argument>-cp</argument> <classpath/> -->
								<!-- This is a hack, because these applications will currently ignore 
									jars, so we need the folders on the classpath, too -->
								<argument>-cp</argument>
								<argument>${project.build.directory}/dependency/*:${elki.projdir}/elki/target/classes:${elki.projdir}/addons/batikvis/target/classes:${elki.projdir}/addons/libsvm/target/classes</argument>
								<!-- Generate algorithm parameter documentations -->
								<argument>de.lmu.ifi.dbs.elki.application.internal.DocumentParameters</argument>
								<argument>${project.build.directory}/apidocs/parameters-byclass.html</argument>
								<argument>${project.build.directory}/apidocs/parameters-byopt.html</argument>
							</arguments>
						</configuration>
					</execution>
					<execution>
						<id>generate-javadoc-references</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>exec</goal>
						</goals>
						<configuration>
							<executable>java</executable>
							<arguments>
								<!-- <argument>-cp</argument> <classpath/> -->
								<!-- This is a hack, because these applications will currently ignore 
									jars, so we need the folders on the classpath, too -->
								<argument>-cp</argument>
								<argument>${project.build.directory}/dependency/*:${elki.projdir}/elki/target/classes:${elki.projdir}/addons/batikvis/target/classes:${elki.projdir}/addons/libsvm/target/classes</argument>
								<!-- Generate literature reference documentations -->
								<argument>de.lmu.ifi.dbs.elki.application.internal.DocumentReferences</argument>
								<argument>${project.build.directory}/apidocs/references.html</argument>
								<argument>${project.build.directory}/apidocs/references.trac</argument>
							</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- jar plugin -->
			<plugin>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<manifestFile>${elki.projdir}/elki/src/main/resources/META-INF/MANIFEST.MF</manifestFile>
						<manifest>
							<mainClass>de.lmu.ifi.dbs.elki.application.ELKILauncher</mainClass>
							<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
						</manifest>
					</archive>
				</configuration>
			</plugin>
			<!-- shade plugin -->
			<plugin>
				<artifactId>maven-shade-plugin</artifactId>
				<version>2.3</version>
				<executions>
					<execution>
						<id>shade</id>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
						<configuration>
							<artifactSet>
								<excludes>
									<!-- Exclude JUnit -->
									<exclude>junit:*</exclude>
									<exclude>org.hamcrest:*</exclude>
								</excludes>
							</artifactSet>
							<transformers>
								<!-- <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 
									<mainClass>de.lmu.ifi.dbs.elki.application.ELKILauncher</mainClass> </transformer> -->
								<!-- Unfortunately, we cannot use wildcards here, we need to list 
									every resource that has multiple implementations. -->
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
									<resource>META-INF/elki/de.lmu.ifi.dbs.elki.application.AbstractApplication</resource>
								</transformer>
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
									<resource>META-INF/elki/de.lmu.ifi.dbs.elki.result.ResultHandler</resource>
								</transformer>
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
									<resource>META-INF/elki/de.lmu.ifi.dbs.elki.visualization.projector.ProjectorFactory</resource>
								</transformer>
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
									<resource>META-INF/elki/de.lmu.ifi.dbs.elki.visualization.visualizers.VisFactory</resource>
								</transformer>
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
									<resource>META-INF/elki/de.lmu.ifi.dbs.elki.algorithm.Algorithm</resource>
								</transformer>
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
									<resource>META-INF/elki/de.lmu.ifi.dbs.elki.algorithm.outlier.OutlierAlgorithm</resource>
								</transformer>
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer">
								</transformer>
							</transformers>
							<filters>
								<!-- We ship a cleaned-up license documentation -->
								<filter>
									<artifact>xml-apis:*</artifact>
									<excludes>
										<exclude>license/**</exclude>
									</excludes>
								</filter>
								<!-- libsvm contains some odd classes that don't belong into a library -->
								<filter>
									<artifact>tw.edu.ntu.csie:*</artifact>
									<excludes>
										<exclude>%regex[^svm_[^/]*class]</exclude>
										<exclude>%regex[^Applet[^/]*class]</exclude>
									</excludes>
								</filter>
								<!-- We ship a cleaned-up license documentation -->
								<filter>
									<artifact>*:*</artifact>
									<excludes>
										<exclude>META-INF/license/**</exclude>
										<exclude>META-INF/LICENSE*</exclude>
										<exclude>META-INF/NOTICE*</exclude>
										<exclude>LICENSE</exclude>
										<exclude>NOTICE</exclude>
										<exclude>%regex[^[^/]*LICENSE.txt]</exclude>
										<exclude>%regex[^[^/]*README.txt]</exclude>
									</excludes>
								</filter>
							</filters>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- copy additional javadoc resources -->
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-resources</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/apidocs/</outputDirectory>
							<resources>
								<resource>
									<directory>${elki.projdir}/elki/src/main/javadoc</directory>
									<excludes>
										<exclude>**/overview.html</exclude>
									</excludes>
								</resource>
								<resource>
									<directory>${elki.projdir}/elki/target/apidocs</directory>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- Build JavaDoc -->
			<plugin>
				<artifactId>maven-javadoc-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>aggregate</goal>
							<goal>javadoc-no-fork</goal>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<overview>${elki.projdir}/elki/src/main/javadoc/overview.html</overview>
					<includeDependencySources>true</includeDependencySources>
					<dependencySourceIncludes>
						<dependencySourceInclude>de.lmu.ifi.dbs.elki:*</dependencySourceInclude>
					</dependencySourceIncludes>
				</configuration>
			</plugin>
			<!-- Fake source code packaging -->
			<plugin>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
						<phase>package</phase>
						<goals>
							<goal>jar-no-fork</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>
