<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.italiangrid</groupId>
  <artifactId>voms-api-java</artifactId>
  <version>3.1.0</version>
  <packaging>jar</packaging>

  <name>voms-api-java</name>
  <description>Java APIs to validate and request VOMS attribute certificates</description>

  <url>https://github.com/italiangrid/voms-api-java</url>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <url>https://github.com/italiangrid/voms-api-java</url>
    <connection>scm:git:git://github.com/italiangrid/voms-api-java.git</connection>
    <developerConnection>scm:git:ssh://git@github.com:italiangrid/voms-api-java.git</developerConnection>
  </scm>

  <properties>
    <!-- versions -->
    <plugin.compiler.version>3.1</plugin.compiler.version>
    <plugin.license.version>1.9.0</plugin.license.version>
    <plugin.release.version>2.2.2</plugin.release.version>
    <plugin.source.version>2.2.1</plugin.source.version>
    <plugin.assembly.version>2.4.1</plugin.assembly.version>
    <plugin.deploy.version>2.8.2</plugin.deploy.version>
    <plugin.jar.version>2.5</plugin.jar.version>
    <plugin.javadoc.version>2.9.1</plugin.javadoc.version>
    <plugin.cobertura.version>2.5.2</plugin.cobertura.version>
    <plugin.gpg.version>1.5</plugin.gpg.version>
    <plugin.nexus-staging.version>1.6.3</plugin.nexus-staging.version>

    <junit.version>4.11</junit.version>
    <hamcrest.version>1.3</hamcrest.version>
    <canl.version>2.1.2</canl.version>
    <mockito.version>1.9.5</mockito.version>
    <jcip.version>1.0</jcip.version>

    <!-- properties -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <assembly.java.dir>/usr/share/java</assembly.java.dir>
    <assembly.doc.dir>/usr/share/doc/${project.name}</assembly.doc.dir>
    <assembly.javadoc.dir>/usr/share/javadoc/${project.name}</assembly.javadoc.dir>

  </properties>

  <developers>
    <developer>
      <id>andreac</id>
      <name>Andrea Ceccanti</name>
      <email>andrea.ceccanti@cnaf.infn.it</email>
      <organization>INFN CNAF</organization>
      <roles>
        <role>Developer</role>
      </roles>
    </developer>
    <developer>
      <id>vventuri</id>
      <name>Valerio Venturi</name>
      <email>valerio.venturi@cnaf.infn.it</email>
      <organization>INFN CNAF</organization>
      <roles>
        <role>Developer</role>
      </roles>
    </developer>
    <developer>
      <id>dandreotti</id>
      <name>Daniele Andreotti</name>
      <email>daniele.andreotti@cnaf.infn.it</email>
      <organization>INFN CNAF</organization>
      <roles>
        <role>Developer</role>
      </roles>
    </developer>
  </developers>

  <build>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${plugin.compiler.version}</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
          <showDeprecation>true</showDeprecation>
          <showWarnings>true</showWarnings>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>${plugin.cobertura.version}</version>
        <configuration>
          <formats>
            <format>html</format>
            <format>xml</format>
          </formats>
          <instrumentation>
            <excludes>
              <exclude>org/italiangrid/voms/test/**/*.class</exclude>
              <exclude>org/italiangrid/voms/examples/**/*.class</exclude>
            </excludes>
          </instrumentation>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>${plugin.assembly.version}</version>
        <configuration>
          <finalName>${project.name}</finalName>
          <appendAssemblyId>false</appendAssemblyId>
          <descriptors>
            <descriptor>${basedir}/src/main/assembly/voms-api-java.xml</descriptor>
          </descriptors>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${plugin.javadoc.version}</version>
        <configuration>
          <outputDirectory>${project.build.directory}/javadoc</outputDirectory>
          <reportOutputDirectory>${project.reporting.outputDirectory}/javadoc</reportOutputDirectory>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>${plugin.source.version}</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.mycila.maven-license-plugin</groupId>
        <artifactId>maven-license-plugin</artifactId>
        <version>${plugin.license.version}</version>
        <configuration>
          <header>src/license/license.txt</header>
          <excludes>
            <exclude>.travis.yml</exclude>
            <exclude>*.md</exclude>
            <exclude>Makefile</exclude>
            <exclude>AUTHORS</exclude>
            <exclude>LICENSE</exclude>
            <exclude>.gitignore</exclude>
            <exclude>spec/**</exclude>
            <exclude>src/test/resources/**</exclude>
            <exclude>src/config/**</exclude>
            <exclude>src/main/java/org/glite/voms/FQAN.java</exclude>
          </excludes>
          <useDefaultExcludes>true</useDefaultExcludes>
          <strictCheck>true</strictCheck>
        </configuration>
        <executions>
          <execution>
            <id>check-headers</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>${plugin.release.version}</version>
        <configuration>
          <mavenExecutorId>forked-path</mavenExecutorId>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>${plugin.deploy.version}</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${plugin.jar.version}</version>
        <configuration>
          <archive>
            <manifest>
               <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-library</artifactId>
      <version>${hamcrest.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>eu.eu-emi.security</groupId>
      <artifactId>canl</artifactId>
      <version>${canl.version}</version>
    </dependency>

    <dependency>
      <groupId>net.jcip</groupId>
      <artifactId>jcip-annotations</artifactId>
      <version>${jcip.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>${mockito.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>release-sign-artifacts</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${plugin.gpg.version}</version>
            <configuration>
              <passphrase>${env.GPG_PASSPHRASE}</passphrase>
            </configuration>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>local-staging</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

      <distributionManagement>
        <repository>
          <id>cnaf-releases</id>
          <name>CNAF releases</name>
          <url>http://radiohead.cnaf.infn.it:8081/nexus/content/repositories/cnaf-releases/</url>
        </repository>

        <snapshotRepository>
          <id>cnaf-snapshots</id>
          <name>CNAF snapshots</name>
          <url>http://radiohead.cnaf.infn.it:8081/nexus/content/repositories/cnaf-snapshots/</url>
        </snapshotRepository>

      </distributionManagement>
    </profile>

    <profile>
      <id>central-staging</id>
      <distributionManagement>
        <snapshotRepository>
          <id>ossrh</id>
          <name>Maven central snapshots</name>
          <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>

        <repository>
          <id>ossrh</id>
          <name>Maven central releases</name>
          <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
      </distributionManagement>

      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>${plugin.nexus-staging.version}</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
