<!--

    Copyright (C) 2015 Tirasa (info@tirasa.net)

    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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <packaging>jar</packaging>

  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>9</version>
  </parent>

  <groupId>net.tirasa</groupId>
  <artifactId>adsddl</artifactId>
  <version>1.9</version>

  <name>ADSDDL</name>
  <url>https://github.com/Tirasa/ADSDDL</url>

  <inceptionYear>2015</inceptionYear>
  
  <organization>
    <name>Tirasa</name>
    <url>http://www.tirasa.net</url>
  </organization>
  
  <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>
    <connection>scm:git:git@github.com:Tirasa/ADSDDL.git</connection>
    <url>scm:git:git@github.com:Tirasa/ADSDDL.git</url>
    <developerConnection>scm:git:git@github.com:Tirasa/ADSDDL.git</developerConnection>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    
    <ldapbp.version>1.0</ldapbp.version>
    <slf4j.version>1.7.10</slf4j.version>
    <log4j.version>2.1</log4j.version>
    <surfire.version>2.18.1</surfire.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.sun.jndi.ldap</groupId>
      <artifactId>ldapbp</artifactId>
      <version>${ldapbp.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <version>${slf4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <version>${log4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>${log4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <version>${log4j.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  
  <build>
    <defaultGoal>clean test</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.4.1</version>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>3.0</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
          <execution>
            <id>copy-javadoc-legal-files</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/apidocs/META-INF</outputDirectory>
              <resources>
                <resource>
                  <directory>.</directory>
                  <includes>
                    <include>LICENSE</include>
                    <include>NOTICE</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>3.0</version>
        <configuration>
          <header>${basedir}/src/main/resources/license-header.txt</header>
          <strictCheck>true</strictCheck>
          <failIfMissing>true</failIfMissing>
          <aggregate>true</aggregate>
          <useDefaultExcludes>true</useDefaultExcludes>
          <useDefaultMapping>true</useDefaultMapping>
          <headerSections>
            <headerSection>
              <key>COPYRIGHT_SECTION</key>
              <defaultValue>Copyright (C) 2015 Tirasa (info@tirasa.net)</defaultValue>
              <ensureMatch>Copyright .*</ensureMatch>
            </headerSection>
          </headerSections>
          <mapping>
            <md>XML_STYLE</md>
            <java>SLASHSTAR_STYLE</java>
          </mapping>
          <excludes>
            <exclude>**/LICENSE*</exclude>
            <exclude>**/NOTICE*</exclude>
            <exclude>**/*.pfx</exclude>
            <exclude>**/*.dll</exclude>
            <exclude>**/*.so</exclude>
            <exclude>**/*.jnilib</exclude>
            <exclude>nbactions.xml</exclude>
            <exclude>nb-configuration.xml</exclude>
            <exclude>**/META-INF/services/**</exclude>
            <exclude>**/*.css</exclude>
            <exclude>**/*.js</exclude>
            <exclude>**/*.csv</exclude>
            <exclude>**/maven-eclipse.xml</exclude>
            <exclude>**/*.iml</exclude>
            <exclude>**/*.log</exclude>
            <exclude>.externalToolBuilders/**</exclude>
            <exclude>.git/**</exclude>
            <exclude>.idea/**</exclude>
            <exclude>**/*.bin</exclude>
            <exclude>**/.*</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <id>check-headers</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>ianal-maven-plugin</artifactId>
        <version>1.0-alpha-1</version>
        <executions>
          <execution>
            <goals>
              <goal>verify-legal-files</goal>
            </goals>
            <configuration>
              <!-- Fail the build if any artifacts are missing legal files -->
              <strict>true</strict>
            </configuration>
          </execution>
        </executions>
      </plugin>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.0</version>
        <configuration>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <encoding>utf-8</encoding>
          <runOrder>alphabetical</runOrder>
          <skipTests>false</skipTests>
          <includes>
            <include>**/unit/*Test.java</include>
          </includes>
        </configuration>
      </plugin>
          
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
        </configuration>
      </plugin>
    </plugins>
    
    <resources>
      <resource>
        <directory>.</directory>
        <targetPath>META-INF</targetPath>
        <includes>
          <include>LICENSE</include>
          <include>NOTICE</include>
        </includes>
      </resource>
    </resources>
  </build>
  
  <profiles>
    <profile>
      <id>it</id>
      
      <build>
        <defaultGoal>clean test</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <redirectTestOutputToFile>true</redirectTestOutputToFile>
              <encoding>utf-8</encoding>
              <runOrder>alphabetical</runOrder>
              <skipTests>false</skipTests>
              <includes>
                <include>**/it/*Test.java</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
      
    </profile>
    
    <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>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  
  <repositories>
    <repository>
      <id>sonatype</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>atalassian</id>
      <url>https://maven.atlassian.com/3rdparty/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>
</project>
