<!-- 
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * or in the "license" file accompanying this file. This file 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>software.amazon.neptune</groupId>
	<artifactId>amazon-neptune-csv2rdf</artifactId>
	<version>1.0.0</version>

	<name>Amazon Neptune CSV to RDF Converter</name>
	<description>
		A tool for Amazon Neptune that converts property graphs stored as comma separated values into RDF graphs.
	</description>

	<url>https://github.com/aws/amazon-neptune-csv-to-rdf-converter</url>

	<licenses>
		<license>
			<name>Apache License, Version 2.0</name>
			<url>https://aws.amazon.com/apache2.0</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<developers>
		<developer>
			<id>amazonwebservices</id>
			<organization>Amazon Web Services</organization>
			<organizationUrl>https://aws.amazon.com</organizationUrl>
			<roles>
				<role>developer</role>
			</roles>
		</developer>
	</developers>

	<distributionManagement>
		<snapshotRepository>
			<id>ossrh</id>
			<url>https://aws.oss.sonatype.org/content/repositories/snapshots/</url>
		</snapshotRepository>
		<repository>
			<id>ossrh</id>
			<url>https://aws.oss.sonatype.org/content/groups/staging/</url>
		</repository>
	</distributionManagement>

	<scm>
		<connection>scm:git:git@github.com:aws/amazon-neptune-csv-to-rdf-converter.git</connection>
		<developerConnection>scm:git:git@github.com:aws/amazon-neptune-csv-to-rdf-converter.git</developerConnection>
		<url>git@github.com:aws/amazon-neptune-csv-to-rdf-converter.git</url>
	  <tag>amazon-neptune-csv2rdf-1.0.0</tag>
  </scm>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<rdf4j-version>3.0.4</rdf4j-version>
		<fat-jar-name>${project.artifactId}</fat-jar-name>
	</properties>

	<dependencies>
		<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.18.10</version>
			<scope>provided</scope>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.7.30</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-slf4j-impl</artifactId>
			<version>2.13.0</version>
			<scope>runtime</scope>
		</dependency>
		<!-- https://mvnrepository.com/artifact/info.picocli/picocli -->
		<dependency>
			<groupId>info.picocli</groupId>
			<artifactId>picocli</artifactId>
			<version>4.1.4</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.10.2</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-properties -->
		<dependency>
			<groupId>com.fasterxml.jackson.dataformat</groupId>
			<artifactId>jackson-dataformat-properties</artifactId>
			<version>2.10.2</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-csv -->
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-csv</artifactId>
			<version>1.7</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.eclipse.rdf4j/rdf4j-rio-api -->
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-rio-api</artifactId>
			<version>${rdf4j-version}</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.eclipse.rdf4j/rdf4j-rio-nquads -->
		<dependency>
			<groupId>org.eclipse.rdf4j</groupId>
			<artifactId>rdf4j-rio-nquads</artifactId>
			<version>${rdf4j-version}</version>
		</dependency>

		<!-- TEST -->

		<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-api</artifactId>
			<version>5.5.2</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>false</filtering>
			</resource>
			<resource>
				<directory>src/main/version</directory>
				<filtering>true</filtering>
			</resource>
		</resources>

		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-source-plugin</artifactId>
					<version>3.2.1</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<version>3.2.0</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>3.0.0-M4</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-failsafe-plugin</artifactId>
					<version>3.0.0-M4</version>
				</plugin>
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>exec-maven-plugin</artifactId>
					<version>1.6.0</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-shade-plugin</artifactId>
					<version>3.2.1</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-gpg-plugin</artifactId>
					<version>1.6</version>
				</plugin>
				<plugin>
					<groupId>org.sonatype.plugins</groupId>
					<artifactId>nexus-staging-maven-plugin</artifactId>
					<version>1.6.8</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-site-plugin</artifactId>
					<version>3.8.2</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-project-info-reports-plugin</artifactId>
					<version>3.0.0</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-enforcer-plugin</artifactId>
					<version>3.0.0-M3</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>3.0.0-M1</version>
				</plugin>
			</plugins>
		</pluginManagement>

		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<failIfNoTests>true</failIfNoTests>
				</configuration>
				<executions>
					<execution>
						<id>default-test</id>
						<goals>
							<goal>test</goal>
						</goals>
						<phase>test</phase>
						<configuration>
							<excludedGroups>IntegrationTest</excludedGroups>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<configuration>
					<createDependencyReducedPom>false</createDependencyReducedPom>
					<shadedArtifactAttached>false</shadedArtifactAttached>
					<finalName>${fat-jar-name}</finalName>
					<transformers>
						<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
							<mainClass>software.amazon.neptune.csv2rdf.Csv2Rdf</mainClass>
						</transformer>
					</transformers>
					<filters>
						<filter>
							<artifact>*:*</artifact>
							<excludes>
								<!-- Avoid warning: Discovered module-info.class. Shading will break 
									its strong encapsulation. -->
								<exclude>module-info.class</exclude>
								<!-- Avoid warning: log4j-api-2.13.0.jar, picocli-4.1.4.jar define 
									1 overlapping classes: META-INF.versions.9.module-info -->
								<exclude>META-INF/versions/9/module-info.class</exclude>
							</excludes>
						</filter>
					</filters>
				</configuration>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<configuration>
					<releaseProfiles>integration,documentation,release</releaseProfiles>
					<!-- enable the profiles during preparation, too -->
					<arguments>-Pintegration,documentation,release</arguments>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<executions>
					<execution>
						<id>enforce</id>
						<configuration>
							<rules>
								<requireProfileIdsExist />
							</rules>
						</configuration>
						<goals>
							<goal>enforce</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>integration</id>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-failsafe-plugin</artifactId>
						<configuration>
							<failIfNoTests>true</failIfNoTests>
							<includes>
								<!-- remove default value -->
								<include />
							</includes>
						</configuration>
						<executions>
							<execution>
								<!-- This test must be run without any logger been initialized by 
									another test. -->
								<id>Csv2RdfLogOutputTest</id>
								<goals>
									<goal>integration-test</goal>
									<goal>verify</goal>
								</goals>
								<configuration>
									<groups>Csv2RdfLogOutputTest</groups>
								</configuration>
							</execution>
							<execution>
								<id>IntegrationTest</id>
								<goals>
									<goal>integration-test</goal>
									<goal>verify</goal>
								</goals>
								<configuration>
									<groups>IntegrationTest</groups>
									<excludedGroups>Csv2RdfLogOutputTest</excludedGroups>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>TestFatJarHelp</id>
								<goals>
									<goal>exec</goal>
								</goals>
								<phase>integration-test</phase>
								<configuration>
									<executable>java</executable>
									<workingDirectory>${project.build.directory}</workingDirectory>
									<arguments>
										<argument>-jar</argument>
										<argument>${fat-jar-name}.jar</argument>
										<argument>-h</argument>
									</arguments>
								</configuration>
							</execution>
							<execution>
								<id>TestFatJarMissingRequiredOptions</id>
								<goals>
									<goal>exec</goal>
								</goals>
								<phase>integration-test</phase>
								<configuration>
									<executable>java</executable>
									<workingDirectory>${project.build.directory}</workingDirectory>
									<arguments>
										<argument>-jar</argument>
										<argument>${fat-jar-name}.jar</argument>
									</arguments>
									<successCodes>
										<!-- expect the failure code -->
										<successCode>2</successCode>
									</successCodes>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>documentation</id>

			<build>
				<plugins>

					<!-- Package the source jar. -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-sources</id>
								<goals>
									<goal>jar-no-fork</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<!-- Package the javadoc jar. -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<configuration>
							<encoding>UTF-8</encoding>
							<header>
								<![CDATA[<a href="${project.url}" target="_blank">${project.name} ${project.version}</a>]]>
							</header>
							<!-- use phrasing content only because bottom is placed into a paragraph 
								element -->
							<bottom>
								<![CDATA[Copyright &#169; Amazon.com, Inc. or its affiliates. All Rights Reserved.]]>
							</bottom>
						</configuration>
						<executions>
							<execution>
								<id>attach-javadocs</id>
								<goals>
									<goal>jar</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>release</id>

			<build>
				<plugins>

					<!-- Sign the artifact -->
					<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>
									<keyname>${gpg.keyname}</keyname>
									<passphrase>${gpg.passphrase}</passphrase>
									<gpgArguments>
										<arg>--pinentry-mode</arg>
										<arg>loopback</arg>
									</gpgArguments>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<!-- Publish the artifacts. -->
					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>nexus-staging-maven-plugin</artifactId>
						<extensions>true</extensions>
						<configuration>
							<serverId>ossrh</serverId>
							<nexusUrl>https://aws.oss.sonatype.org/</nexusUrl>
							<autoReleaseAfterClose>false</autoReleaseAfterClose>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>
