<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright © 2019-20 e-UCM (http://www.e-ucm.es/)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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>

    <groupId>es.e-ucm.tracker</groupId>
    <artifactId>tracker-parent</artifactId>
    <version>0.1.0</version>
    <packaging>pom</packaging>

    <name>Java xAPI Tracker Parent</name>
    <description>Java xAPI tracker parent project</description>
	<url>https://github.com/e-ucm/java-tracker</url>
	
	<licenses>
		<license>
			<name>The Apache Software License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
		</license>
	</licenses>

	<developers>
		<developer>
			<name>Ivan Martinez-Ortiz</name>
			<email>imartinezortiz@gmail.com</email>
			<organization>e-UCM</organization>
			<organizationUrl>https://www.e-ucm.es/</organizationUrl>
		</developer>
		<developer>
			<name>Ivan J. Perez-Colado</name>
			<email>synpheros@hotmail.com</email>
			<organization>e-UCM</organization>
			<organizationUrl>https://www.e-ucm.es/</organizationUrl>
		</developer>
	</developers>
  
	<scm>
		<connection>scm:git:github.com/e-ucm/java-tracker.git</connection>
		<developerConnection>scm:git:ssh://github.com/e-ucm/java-tracker.git</developerConnection>
		<url>https://github.com/e-ucm/java-tracker/tree/master</url>
	</scm>

	<distributionManagement>
		<snapshotRepository>
			<id>ossrh</id>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
		</snapshotRepository>
		<repository>
			<id>ossrh</id>
			<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
		</repository>
	</distributionManagement>
  
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
	</properties>
	
    <pluginRepositories>
        <pluginRepository>
            <id>nexus-oss-maven-plugin-snapshots</id>
            <name>Sonatype Nexus OSS maven plugin snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <layout>default</layout>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

	<repositories>
		<repository>
            <id>nexus-oss--snapshots</id>
            <name>Sonatype Nexus OSS maven snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <layout>default</layout>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
	</repositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>2.8.5</version>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.11</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <modules>
        <module>build-tools</module>
        <module>tracker</module>
        <module>swing-example</module>
        <module>formalZ</module>
    </modules>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
 
                <!-- Set up the LICENSE Header plugin -->
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>3.0</version>
                    <configuration>
                        <header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
                        <properties>
                            <project.inceptionYear>2019-20</project.inceptionYear>
                            <owner>e-UCM</owner>
                            <email>http://www.e-ucm.es/</email>
                        </properties>
                        <excludes>
                            <exclude>**/README</exclude>
                            <exclude>src/test/resources/**</exclude>
                            <exclude>src/main/resources/**</exclude>
                            <exclude>**/logs/**</exclude>
                            <exclude>logs/**</exclude>
                            <exclude>*.yaml</exclude>
                            <exclude>*.yml</exclude>
                        </excludes>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Java formatter -->
				<plugin>
					<groupId>net.revelc.code.formatter</groupId>
					<artifactId>formatter-maven-plugin</artifactId>
					<version>2.11.0</version>
                    <configuration>
                        <compilerCompliance>${java.version}</compilerCompliance>
                        <compilerSource>${java.version}</compilerSource>
                        <configFile>eclipse/eclipse-formatter.xml</configFile>
                        <lineEnding>KEEP</lineEnding>
                        <excludes>
                            <exclude>**/.m2/</exclude>
                        </excludes>
                    </configuration>
					<executions>
						<execution>
							<goals>
								<goal>format</goal>
							</goals>
						</execution>
					</executions>
					<dependencies>
						<dependency>
							<groupId>es.e-ucm.tracker</groupId>
							<artifactId>build-tools</artifactId>
							<version>0.1.0</version>
						</dependency>
					</dependencies>
				</plugin>

                <!-- Set up the Cobertura Maven plugin in the build section of the project pom.xml -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>cobertura-maven-plugin</artifactId>
                    <version>2.7</version>
                    <configuration>
                        <format>xml</format>
                        <maxmem>512m</maxmem>
                        <!-- aggregated reports for multi-module projects -->
                        <aggregate>true</aggregate>
                    </configuration>
                </plugin>

                <!-- Set up the Coveralls maven plugin in the build section of the project pom.xml -->
                <plugin>
                    <groupId>org.eluder.coveralls</groupId>
                    <artifactId>coveralls-maven-plugin</artifactId>
                    <version>4.3.0</version>
                    <configuration>
                        <coberturaReports>
                            <coberturaReport>
                                ${basedir}/swing-example/target/coverage.xml
                            </coberturaReport>
                            <coberturaReport>
                                ${basedir}/tracker/target/coverage.xml
                            </coberturaReport>
                        </coberturaReports>
                        <scanForSources>true</scanForSources>
                        <sourceEncoding>UTF-8</sourceEncoding>
                        <serviceName>travis-ci</serviceName>
                    </configuration>
                </plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-source-plugin</artifactId>
					<version>3.0.1</version>
					<executions>
						<execution>
							<id>attach-sources</id>
							<goals>
								<goal>jar-no-fork</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<version>3.1.0</version>
					<executions>
						<execution>
							<id>attach-javadocs</id>
							<goals>
								<goal>jar</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-gpg-plugin</artifactId>
					<version>1.6</version>
					<executions>
						<execution>
							<id>sign-artifacts</id>
							<phase>verify</phase>
							<goals>
								<goal>sign</goal>
							</goals>
							<configuration>
								<!-- Although there is a <homedir> parameter, seems that there is a problem
								signing the artifact in windows using a gpg cywin binary because the paths
								are messed up. -->
								<!-- mvn -P ossrh deploy -->
								<!-- Sample maven settings.xml file 
								<settings>
									<servers>
										<server>
											<id>ossrh</id>
											<username>USERNAME</username>
											<password>PASSWORD</password>
										</server>
										<server>
											<id>KEY_ID</id>
											<passphrase>GPG_PASSPHRASE</passphrase>
										</server>
									</servers>
									<profiles>
									  <profile>
									      <id>ossrh</id>
									      <properties>
									        <gpg.executable>gpg</gpg.executable>
									        <gpg.keyname>KEY_ID</gpg.keyname>
											<gpg.home>PATH_TO_FOLDER_CONTAINING_GPG_RINGS</gpg.home>
									      </properties>
									  	</profile>
									</profiles>
								</settings>
								-->
								<gpgArguments>
									<arg>--homedir=${gpg.home}</arg>
								</gpgArguments>
								<keyname>${gpg.keyname}</keyname>
								<passphraseServerId>${gpg.keyname}</passphraseServerId>
							</configuration>
						</execution>
					</executions>
				</plugin>
				<!--
				  1. Have a look to the staging repository: https://oss.sonatype.org/
				  2.
				    - If looks good: mvn -P ossrh nexus-staging:release
				    - If not: mvn -P ossrh nexus-staging:drop
				-->
				<plugin>
					<groupId>org.sonatype.plugins</groupId>
					<artifactId>nexus-staging-maven-plugin</artifactId>
					<version>1.6.7</version>
					<extensions>true</extensions>
					<configuration>
						<serverId>ossrh</serverId>
						<nexusUrl>https://oss.sonatype.org/</nexusUrl>
						<autoReleaseAfterClose>false</autoReleaseAfterClose>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>3.0.0-M1</version>
				</plugin>
            </plugins>
        </pluginManagement>
    </build>
	<profiles>
		<profile>
			<id>ossrh</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
								<configuration>
									<!-- Although there is a <homedir> parameter, seems that there is a problem
									signing the artifact in windows using a gpg cywin binary because the paths
									are messed up. -->
									<!-- mvn -P ossrh deploy -->
									<!-- Sample maven settings.xml file 
									<settings>
										<servers>
											<server>
												<id>ossrh</id>
												<username>USERNAME</username>
												<password>PASSWORD</password>
											</server>
											<server>
												<id>KEY_ID</id>
												<passphrase>GPG_PASSPHRASE</passphrase>
											</server>
										</servers>
										<profiles>
										  <profile>
										      <id>ossrh</id>
										      <properties>
										        <gpg.executable>gpg</gpg.executable>
										        <gpg.keyname>KEY_ID</gpg.keyname>
												<gpg.home>PATH_TO_FOLDER_CONTAINING_GPG_RINGS</gpg.home>
										      </properties>
										  	</profile>
										</profiles>
									</settings>
									-->
									<gpgArguments>
										<arg>--homedir=${gpg.home}</arg>
									</gpgArguments>
									<keyname>${gpg.keyname}</keyname>
									<passphraseServerId>${gpg.keyname}</passphraseServerId>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<!-- 
					  1. Have a look to the staging repository: https://oss.sonatype.org/
					  2.
					    - If looks good: mvn -P ossrh nexus-staging:release
					    - If not: mvn -P ossrh nexus-staging:drop
					-->
					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>nexus-staging-maven-plugin</artifactId>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
