<?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>

	<!--
	mvn clean
	mvn compile
	mvn deploy -Psonatype-oss-release
	-->

	<groupId>org.ode4j</groupId>
	<artifactId>parent</artifactId>
	<version>0.4.0</version>
	<packaging>pom</packaging>

	<modules>
		<module>core</module>
		<module>core-cpp</module>
		<module>demo</module>
		<module>demo-cpp</module>
	</modules>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

		<ode4j.bnd-maven-plugin.version>3.5.0</ode4j.bnd-maven-plugin.version>
		<ode4j.build-helper-maven-plugin.version>3.0.0</ode4j.build-helper-maven-plugin.version>
		<ode4j.maven-clean-plugin.version>3.0.0</ode4j.maven-clean-plugin.version>
		<ode4j.maven-compiler-plugin.version>3.7.0</ode4j.maven-compiler-plugin.version>
		<ode4j.maven-deploy-plugin.version>2.8.2</ode4j.maven-deploy-plugin.version>
		<ode4j.maven-enforcer-plugin.version>3.0.0-M1</ode4j.maven-enforcer-plugin.version>
		<ode4j.maven-gpg-plugin.version>1.6</ode4j.maven-gpg-plugin.version>
		<ode4j.maven-install-plugin.version>2.5.2</ode4j.maven-install-plugin.version>
		<ode4j.maven-jar-plugin.version>3.1.0</ode4j.maven-jar-plugin.version>
		<ode4j.maven-javadoc-plugin.version>3.0.0-M1</ode4j.maven-javadoc-plugin.version>
		<ode4j.maven-nativedependencies-plugin.version>0.0.7</ode4j.maven-nativedependencies-plugin.version>
		<ode4j.maven-plugin-plugin.version>3.2</ode4j.maven-plugin-plugin.version>
		<ode4j.maven-resources-plugin.version>3.0.0</ode4j.maven-resources-plugin.version>
		<ode4j.maven-source-plugin.version>3.0.1</ode4j.maven-source-plugin.version>
		<ode4j.maven-surefire-plugin.version>2.19.1</ode4j.maven-surefire-plugin.version>
		<ode4j.nexus-staging-maven-plugin.version>1.6.8</ode4j.nexus-staging-maven-plugin.version>
	</properties>

	<prerequisites>
		<maven>3.3.3</maven>
	</prerequisites>

	<parent>
		<groupId>org.sonatype.oss</groupId>
		<artifactId>oss-parent</artifactId>
		<version>7</version>
	</parent>

	<name>ODE for Java</name>
	<description>Java 3D Physics Engine and Library.</description>
	<url>https://github.com/tzaeschke/ode4j</url>

	<licenses>
		<license>
			<name>GNU Lesser General Public License</name>
			<url>http://www.gnu.org/licenses/lgpl.html</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<scm>
		<url>https://github.com/tzaeschke/ode4j</url>
		<connection>scm:git:git@github.com:tzaeschke/ode4j.git</connection>
		<developerConnection>scm:git:git@github.com:tzaeschke/ode4j.git</developerConnection>
	</scm>

	<developers>
		<developer>
			<name>Tilmann Zäschke</name>
			<id>tzaeschke</id>
			<email>zoodb@gmx.de</email>
		</developer>
	</developers>

	<issueManagement>
		<system>github</system>
		<url>https://github.com/tzaeschke/ode4j/issues</url>
	</issueManagement>

	<repositories>
		<repository>
			<id>sonatype-snapshots</id>
			<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>

	<!-- mvn versions:display-dependency-updates -->
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.lwjgl.lwjgl</groupId>
				<artifactId>lwjgl_util</artifactId>
				<version>2.9.3</version>
			</dependency>

			<!-- Note that this is upgraded in the on-jdk-9 profile below -->
			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-api</artifactId>
				<version>1.7.0</version>
			</dependency>

			<dependency>
				<groupId>junit</groupId>
				<artifactId>junit</artifactId>
				<version>4.12</version>
				<scope>test</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<!-- mvn versions:display-plugin-updates -->
	<build>
		<pluginManagement>
			<plugins>

				<!--
				  Well-known core plugins used everywhere.
				-->

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-clean-plugin</artifactId>
					<version>${ode4j.maven-clean-plugin.version}</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>${ode4j.maven-deploy-plugin.version}</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-install-plugin</artifactId>
					<version>${ode4j.maven-install-plugin.version}</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-resources-plugin</artifactId>
					<version>${ode4j.maven-resources-plugin.version}</version>
				</plugin>

				<!--
					Build helper plugin.
					http://www.mojohaus.org/build-helper-maven-plugin/index.html
				-->
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>build-helper-maven-plugin</artifactId>
					<version>${ode4j.build-helper-maven-plugin.version}</version>
				</plugin>

				<!--
					Enforcer plugin.
					https://maven.apache.org/enforcer/maven-enforcer-plugin/
				-->

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-enforcer-plugin</artifactId>
					<version>${ode4j.maven-enforcer-plugin.version}</version>
				</plugin>

				<!--
					Maven GPG plugin.
					https://maven.apache.org/plugins/maven-gpg-plugin/
				-->

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-gpg-plugin</artifactId>
					<version>${ode4j.maven-gpg-plugin.version}</version>
					<executions>
						<execution>
							<id>sign-artifacts</id>
							<phase>verify</phase>
							<goals>
								<goal>sign</goal>
							</goals>
						</execution>
					</executions>
				</plugin>

				<!--
					Maven Compiler plugin.
					https://maven.apache.org/plugins/maven-compiler-plugin/
				-->

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>${ode4j.maven-compiler-plugin.version}</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-plugin-plugin</artifactId>
					<version>${ode4j.maven-plugin-plugin.version}</version>
				</plugin>

				<plugin>
					<!-- mvn nativedependencies:copy -->
					<groupId>com.googlecode.mavennatives</groupId>
					<artifactId>maven-nativedependencies-plugin</artifactId>
					<version>${ode4j.maven-nativedependencies-plugin.version}</version>
					<executions>
						<execution>
							<id>unpacknatives</id>
							<phase>generate-resources</phase>
							<goals>
								<goal>copy</goal>
							</goals>
						</execution>
					</executions>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>${ode4j.maven-surefire-plugin.version}</version>
					<configuration>
						<printSummary>true</printSummary>
						<skipTests>false</skipTests>
						<includes>
							<!-- include ALL tests -->
							<include>**/*.java</include>
						</includes>
						<excludes>
							<!-- exclude tests that currently fail -->
							<exclude>**/tests/JavaMultiThreadTest.java</exclude>
							<exclude>**/tests/bugs/Test_Bug0019_OdeRayToCylinder.java</exclude>
							<exclude>**/tests/CollisionTest.java</exclude>
							<exclude>**/tests/TestIssue0018_NpeInQuickstep.java</exclude>
						</excludes>
					</configuration>
				</plugin>

				<!--
				  Bnd Maven Plugin
				  Produces OSGi manifests

				  https://github.com/bndtools/bnd
				-->
				<plugin>
					<groupId>biz.aQute.bnd</groupId>
					<artifactId>bnd-maven-plugin</artifactId>
					<version>${ode4j.bnd-maven-plugin.version}</version>
					<configuration>
						<bnd><![CDATA[
							Bundle-DocURL: ${project.url}
							Bundle-Name: ${project.name} ${project.version} - ${project.description}
							Bundle-Description: ${project.description}
							Bundle-SCM: ${project.scm.url}
							Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=7.0))"
]]></bnd>
					</configuration>
				</plugin>

				<!--
				  Maven Jar plugin

				  https://maven.apache.org/plugins/maven-jar-plugin/index.html
				-->
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-jar-plugin</artifactId>
					<version>${ode4j.maven-jar-plugin.version}</version>
					<executions>

						<!-- Produce jar file with custom manifest -->
						<execution>
							<id>default-jar</id>
							<configuration>
								<archive>
									<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
								</archive>
							</configuration>
							<goals>
								<goal>jar</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</pluginManagement>

		<plugins>
			<!-- Check various preconditions for building. -->
			<plugin>
				<artifactId>maven-enforcer-plugin</artifactId>
				<executions>
					<execution>
						<id>enforce-rules</id>
						<phase>validate</phase>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<!-- Require JDK 7+ -->
								<requireJavaVersion>
									<version>[1.7,)</version>
								</requireJavaVersion>
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<!--
				Set the default source level to 1.7.

				This is overridden when running on JDK 9 and above (see the
				on-jdk-9-plus profile).
			-->
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>

			<!--
			  Produce an OSGi manifest
			-->
			<plugin>
				<groupId>biz.aQute.bnd</groupId>
				<artifactId>bnd-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>generate-osgi-manifest</id>
						<goals>
							<goal>bnd-process</goal>
						</goals>
						<phase>process-classes</phase>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<profiles>

		<!--
			A profile activated when the building JDK is >= JDK 9.
		-->
		<profile>
			<id>on-jdk-9-plus</id>
			<activation>
				<jdk>[9, )</jdk>
			</activation>

			<!-- Upgrade SLF4J to a newer version for JDK 9 -->
			<dependencyManagement>
				<dependencies>
					<dependency>
						<groupId>org.slf4j</groupId>
						<artifactId>slf4j-api</artifactId>
						<version>1.8.0-beta1</version>
					</dependency>
				</dependencies>
			</dependencyManagement>

			<build>
				<plugins>

					<!--
						When running on JDK 9, add src/main/java9 directories to the
						directories considered by the compiler.
					-->

					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>add-source</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>add-source</goal>
								</goals>
								<configuration>
									<sources>
										<source>${project.basedir}/src/main/java9</source>
									</sources>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<!--
						Conditionally compile the available sources. First, all of
						the sources are compiled as Java 9 in order to ensure that the
						module descriptor is correct. Then, all of the sources except
						for the module descriptor are recompiled as Java 7 code.
					-->

					<plugin>
						<artifactId>maven-compiler-plugin</artifactId>
						<executions>
							<execution>
								<id>default-compile</id>
								<configuration>
									<!-- Compile everything to ensure module-info contains the
									     right entries -->
									<release>9</release>
									<source>9</source>
									<target>9</target>
								</configuration>
							</execution>

							<execution>
								<id>base-compile</id>
								<goals>
									<goal>compile</goal>
								</goals>

								<!-- Recompile everything for the target VM except the
										 module-info.java -->
								<configuration>
									<excludes>
										<exclude>module-info.java</exclude>
									</excludes>
									<release>7</release>
									<source>7</source>
									<target>7</target>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>
