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

    ====================
    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

    Copyright 2011 ConnId. All rights reserved.

    The contents of this file are subject to the terms of the Common Development
    and Distribution License("CDDL") (the "License").  You may not use this file
    except in compliance with the License.

    You can obtain a copy of the License at
    http://opensource.org/licenses/cddl1.php
    See the License for the specific language governing permissions and limitations
    under the License.

    When distributing the Covered Code, include this CDDL Header Notice in each file
    and include the License file at http://opensource.org/licenses/cddl1.php.
    If applicable, add the following below this CDDL Header, with the fields
    enclosed by brackets [] replaced by your own identifying information:
    "Portions Copyrighted [year] [name of copyright owner]"
    ====================

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

  <parent>
    <groupId>net.tirasa.connid</groupId>
    <artifactId>connid</artifactId>
    <version>1.5.2.0</version>
  </parent>

  <groupId>net.tirasa.connid.bundles</groupId>
  <artifactId>net.tirasa.connid.bundles.ldap</artifactId>
  <version>1.5.9</version>

  <name>ConnId Bundles: LDAP</name>

  <packaging>jar</packaging>

  <url>http://connid.tirasa.net</url>

  <licenses>
    <license>
      <name>CDDL 1.0</name>
      <url>http://opensource.org/licenses/CDDL-1.0</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:Tirasa/ConnIdLDAPBundle.git</connection>
    <url>scm:git:git@github.com:Tirasa/ConnIdLDAPBundle.git</url>
    <developerConnection>scm:git:git@github.com:Tirasa/ConnIdLDAPBundle.git</developerConnection>
    <tag>net.tirasa.connid.bundles.ldap-1.5.9</tag>
  </scm>

  <issueManagement>
    <system>jira</system>
    <url>https://connid.atlassian.net/browse/LDAP</url>
  </issueManagement>

  <ciManagement>
    <system>GitHub Workflow</system>
    <url>https://github.com/Tirasa/ConnIdLDAPBundle/actions</url>
  </ciManagement>

  <mailingLists>
    <mailingList>
      <name>connid-dev</name>
      <post>connid-dev@googlegroups.com</post>
      <archive>http://groups.google.com/group/connid-dev</archive>
    </mailingList>
    <mailingList>
      <name>connid-users</name>
      <post>connid-users@googlegroups.com</post>
      <archive>http://groups.google.com/group/connid-users</archive>
    </mailingList>
  </mailingLists>

  <properties>
    <connid.version>1.5.2.0</connid.version>
    
    <opendj.host>localhost</opendj.host>
    <opendj.port>1389</opendj.port>
    <opendj.sslport>1636</opendj.sslport>
    <opendj.principal>cn=Directory Manager</opendj.principal>
    <opendj.credentials>password</opendj.credentials>
    <opendj.baseDN>dc=example,dc=com</opendj.baseDN>
        
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <netbeans.hint.license>connid</netbeans.hint.license>
  </properties>

  <dependencies>
    <dependency>
      <groupId>net.tirasa.connid</groupId>
      <artifactId>connector-framework</artifactId>
      <version>${connid.version}</version>
    </dependency>

    <dependency>
      <groupId>net.tirasa.connid</groupId>
      <artifactId>connector-framework-internal</artifactId>
      <version>${connid.version}</version>
    </dependency>
        
    <dependency>
      <groupId>org.glassfish.main.external</groupId>
      <artifactId>ldapbp-repackaged</artifactId>
      <version>5.0</version>
    </dependency>
        
    <!-- TEST -->
    <dependency>
      <groupId>berkeleydb</groupId>
      <artifactId>je</artifactId>
      <version>3.2.76</version>
      <scope>test</scope>
    </dependency>
        
    <dependency>
      <groupId>net.tirasa.connid</groupId>
      <artifactId>connector-test-common</artifactId>
      <version>${connid.version}</version>
      <scope>test</scope>
    </dependency>
        
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
            
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <header>https://raw.githubusercontent.com/Tirasa/ConnId/connid-${connid.version}/java/src/main/resources/header.txt</header>
          <headerDefinitions>
            <headerDefinition>https://raw.githubusercontent.com/Tirasa/ConnId/connid-${connid.version}/java/src/main/resources/java-single-star.xml</headerDefinition>
          </headerDefinitions>          
          <excludes>
            <exclude>README.md</exclude>
            <exclude>**/LICENSE*</exclude>
            <exclude>**/.*</exclude>
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.4.1</version>
        <executions>
          <execution>
            <id>default-cli</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>${targetJdk}</version>
                </requireJavaVersion>
                <requireMavenVersion>
                  <version>3.9.5</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.gaul</groupId>
        <artifactId>modernizer-maven-plugin</artifactId>
        <version>2.8.0</version>
        <configuration>
          <javaVersion>${targetJdk}</javaVersion>
          <exclusions>
            <exclusion>java/util/Enumeration</exclusion>
            <exclusion>java/util/Hashtable."&lt;init&gt;":(IF)V</exclusion>
            <exclusion>java/util/Hashtable."&lt;init&gt;":(I)V</exclusion>
            <exclusion>java/util/Hashtable."&lt;init&gt;":()V</exclusion>
            <exclusion>java/util/Hashtable."&lt;init&gt;":(Ljava/util/Map;)V</exclusion>
          </exclusions>          
        </configuration>
        <executions>
          <execution>
            <id>modernizer-check</id>
            <phase>verify</phase>
            <goals>
              <goal>modernizer</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <inherited>true</inherited>
        <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>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.44.0</version>
        <configuration>
          <images>
            <image>
              <alias>ldap</alias>
              <name>connid/opendj</name>
              <build>
                <contextDir>${project.basedir}/src/test/resources/opendj</contextDir>
              </build>
              <run>
                <ports>
                  <port>1389:1389</port>
                  <port>1636:1636</port>
                </ports>
                <wait>
                  <log>OpenDJ is started</log>
                  <time>200000</time>
                </wait>
              </run>
            </image>
          </images>
        </configuration>
        <executions>
          <execution>
            <id>build-docker</id>
            <phase>initialize</phase>
            <goals>
              <goal>stop</goal>
              <goal>remove</goal>
            </goals>
          </execution>
          <execution>
            <id>start-docker</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>build</goal>
              <goal>start</goal>
            </goals>
          </execution>
          <execution>
            <id>remove-containers-post-integration</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
              <goal>remove</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.geronimo.genesis.plugins</groupId>
        <artifactId>tools-maven-plugin</artifactId>
        <version>1.4</version>
        <configuration>
          <requiredFiles>
            <requiredFile>LICENSE</requiredFile>
          </requiredFiles>
          <!-- Fail the build if any artifacts are missing legal files -->
          <strict>true</strict>
        </configuration>
        <executions>
          <execution>
            <id>verify-legal-files</id>
            <phase>verify</phase>
            <goals>
              <goal>verify-legal-files</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <skipTests>true</skipTests>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>3.2.5</version>
        <configuration>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <runOrder>alphabetical</runOrder>
          <includes>
            <include>**/*Tests.java</include>
          </includes>
        </configuration>
        <executions>
          <execution>
            <id>verify</id>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <appendAssemblyId>true</appendAssemblyId>
          <descriptors>
            <descriptor>src/assemble/connector.xml</descriptor>
          </descriptors>
          <archive>
            <index>true</index>
            <manifestEntries>
              <ConnectorBundle-FrameworkVersion>${connid.version}</ConnectorBundle-FrameworkVersion>
              <ConnectorBundle-Name>${project.artifactId}</ConnectorBundle-Name>
              <ConnectorBundle-Version>${project.version}</ConnectorBundle-Version>
            </manifestEntries>
          </archive>
        </configuration>
        <executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>.</directory>
        <targetPath>META-INF</targetPath>
        <includes>
          <include>LICENSE</include>
        </includes>
      </resource>
    </resources>

    <testResources>
      <testResource>
        <directory>${basedir}/src/test/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>test.properties</include>
        </includes>
      </testResource>
      <testResource>
        <directory>${basedir}/src/test/resources/net</directory>   
        <targetPath>${project.build.directory}/test-classes/net</targetPath>     
        <filtering>false</filtering>
      </testResource>
      <testResource>
        <directory>${basedir}/src/test/resources/opendj</directory>        
        <targetPath>${project.build.directory}/test-classes/opendj</targetPath>     
        <filtering>false</filtering>
      </testResource>
    </testResources>
  </build>

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

  <profiles>
    <profile>
      <id>java11+</id>
      <activation>
        <jdk>[11,)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <argLine>
                --add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMED
              </argLine>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>ianal-maven-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>sonatype-oss-release</id>
      
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.3.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
                <configuration>
                  <includes>
                    <include>${basedir}/LICENSE</include>
                  </includes>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
