<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>org.datakurator</groupId>
    <artifactId>kurator-validation</artifactId>
    <version>1.0.2</version>
    <packaging>jar</packaging>
    <name>kurator-validation</name>
	<description>Kurator validation biodiversity data quality tools.  Actors (mostly python based) and workflows building on the Kurator-akka framework for the biodiversity data domain.</description>
	<url>https://wiki.datakurator.org/</url>
	<licenses>
		<license>
			<name>Apache license, Version 2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
		</license>
	</licenses>
	<developers>
		<developer>
			<name>Timothy McPhillips</name>
			<email>tmcphillips@absoluteflow.org</email>
		</developer>
		<developer>
			<name>John Wieczorek</name>
			<email>tuco@berkeley.edu</email>
            <organization>Museum of Comparative Zoology, Harvard University</organization>
            <organizationUrl>https://www.mcz.harvard.edu/</organizationUrl>
		</developer>
        <developer>
            <name>David B. Lowery</name>
            <email>lowerydb@gmail.com</email>
            <organization>Museum of Comparative Zoology, Harvard University</organization>
            <organizationUrl>https://www.mcz.harvard.edu/</organizationUrl>
        </developer>
		<developer>
			<name>Paul J. Morris</name>
			<email>mole@morris.net</email>
			<organization>Museum of Comparative Zoology, Harvard University</organization>
			<organizationUrl>https://www.mcz.harvard.edu/</organizationUrl>
		</developer>
	</developers>
	<scm>
		<connection>scm:git:git@github.com:kurator-org/kurator-validation.git</connection>
		<developerConnection>scm:git:git@github.com:kurator-org/kurator-validation.git</developerConnection>
		<url>git@github.com:kurator-org/kurator-validation.git</url>
	</scm>

	<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        
        <repository>
            <id>ossrh-snapshots</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>ncsa.oss-sonatype</id>
            <name>NCSA OSS-Sonatype Repository</name>
            <url>https://opensource.ncsa.illinois.edu/nexus/content/repositories/releases/</url>
        </repository>
        
        <repository>
            <id>gbif-all</id>
            <url>http://repository.gbif.org/content/groups/gbif</url>
        </repository>        
        
    </repositories>

    <dependencies>

        <dependency>
            <groupId>org.datakurator</groupId>
            <artifactId>kurator-akka</artifactId>
            <version>1.0.2-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.datakurator</groupId>
            <artifactId>kurator-ffdq</artifactId>
            <version>1.0.4-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.filteredpush</groupId>
            <artifactId>event_date_qc</artifactId>
            <version>1.1.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.filteredpush</groupId>
            <artifactId>geo_ref_qc</artifactId>
            <version>1.0.1-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.filteredpush</groupId>
            <artifactId>sci_name_qc</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>        
        
        <dependency>
          <groupId>org.kurator</groupId>
          <artifactId>suds_jurko</artifactId>
          <version>0.6</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>

        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>1.13</version>
            <optional>true</optional>
        </dependency>
        
       <dependency>
            <groupId>org.gbif</groupId>
            <artifactId>dwca-io</artifactId>
            <version>1.23</version>
        </dependency>        
        
    </dependencies>

	<build>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/python</directory>
                <excludes>
                    <exclude>**/*.pyc</exclude>
                    <exclude>**/*.class</exclude>
                    <exclude>**/*.gz</exclude>
                    <exclude>**/*.class</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/test/resources</directory>
            </resource>
        </resources>

        <plugins>

            <!-- Set Java compiler source and target versions -->
	        <plugin>
	           <groupId>org.apache.maven.plugins</groupId>
	           <artifactId>maven-compiler-plugin</artifactId>
	           <version>2.3.2</version>
	           <configuration>
	               <source>1.8</source>
	               <target>1.8</target>
	           </configuration>
	       </plugin>

	       <!-- Copy the dependency jars into the target/dependency directory -->
	       <plugin>
	           <groupId>org.apache.maven.plugins</groupId>
	           <artifactId>maven-dependency-plugin</artifactId>
	           <executions>
	               <execution>
    	               <id>copy</id>
    	               <phase>compile</phase>
    	               <goals>
	                       <goal>copy-dependencies</goal>
	                   </goals>
	               </execution>
	           </executions>
      	 </plugin>

    	   <!-- Add the manifest file to the jar and force classpath to the 
                dependency directory to automatically include the dependency jars -->
    	   <plugin>
    	       <groupId>org.apache.maven.plugins</groupId>
    	       <artifactId>maven-jar-plugin</artifactId>
	           <version>2.6</version>
    	       <configuration>
    	           <archive>
    	               <manifest>
    	                   <addClasspath>true</addClasspath>
    	                   <mainClass>org.kurator.akka.KuratorCLI</mainClass>
    	                   <!--  <classpathPrefix>dependency/</classpathPrefix>-->
    	               </manifest>
    	           </archive>
                </configuration>
    	   </plugin>       
    
        	<!-- Build source jar (for maven central) -->      	
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        	<!-- Build javadocs -->      	
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <!-- Make a standalone jar file -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>org.kurator.akka.KuratorCLI</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
        	<plugins>
            
        		<!--This plugin's configuration is used to store Eclipse m2e settings only. 
                    It has no influence on the Maven build itself -->
        		<plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
	                   <lifecycleMappingMetadata>
	                       <pluginExecutions>
	                           <pluginExecution>
	                               <pluginExecutionFilter>
	                                   <groupId>
	                                       org.apache.maven.plugins
	                                    </groupId>
	                                   <artifactId>
	                                       maven-dependency-plugin
	                                   </artifactId>
	                                   <versionRange>
	                                       [2.8,)
	                                   </versionRange>
	                                   <goals>
	                                       <goal>
	                                           copy-dependencies
	                                       </goal>
	                                   </goals>
                                   </pluginExecutionFilter>
	                               <action>
	                                   <ignore></ignore>
	                               </action>
	                           </pluginExecution>
	                       </pluginExecutions>
	                   </lifecycleMappingMetadata>
	               </configuration>
	           </plugin>

	       </plugins>
	   </pluginManagement>
       
	</build>

    <profiles>
        <profile>
            <activation>
                <file>
                    <exists>keytool.properties</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <!-- Make a packages zip file -->
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptors>
                                <descriptor>src/assembly/packages.xml</descriptor>
                            </descriptors>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Read keystore properties from the keytool.properties file -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>properties-maven-plugin</artifactId>
                        <version>1.0.0</version>
                        <executions>
                            <execution>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>read-project-properties</goal>
                                </goals>
                                <configuration>
                                    <files>
                                        <file>keytool.properties</file>
                                    </files>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Create the certificate or keystore and export certificate to target directory -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>keytool-maven-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>generateKeyPair</goal>
                                    <goal>exportCertificate</goal>
                                </goals>
                                <phase>prepare-package</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <keystore>${keystore}</keystore>
                            <storepass>${storepass}</storepass>
                            <keypass>${keypass}</keypass>
                            <alias>${alias}</alias>
                            <file>${basedir}/target/${alias}.crt</file>
                            <dname>CN=${fullname}, O=${affiliation}, L=${city}, S=${state}, C=${countryCode}</dname>
                            <skipIfExist>true</skipIfExist>
                        </configuration>
                    </plugin>

                    <!-- use jarsigner on packages zip file -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jarsigner-plugin</artifactId>
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>sign</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <archiveDirectory>${project.build.directory}</archiveDirectory>
                            <includes>
                                <include>*.zip</include>
                            </includes>
                            <excludes>
                                <exclude>*.jar</exclude>
                            </excludes>
                            <keystore>${keystore}</keystore>
                            <alias>${alias}</alias>
                            <storepass>${storepass}</storepass>
                            <keypass>${keypass}</keypass>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <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>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

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