<?xml version="1.0" encoding="UTF-8"?>
<!--
  The contents of this file are subject to the terms of the Common Development and
  Distribution License (the License). You may not use this file except in compliance with the
  License.

  You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
  specific language governing permission and limitations under the License.

  When distributing Covered Software, include this CDDL Header Notice in each file and include
  the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
  Header, with the fields enclosed by brackets [] replaced by your own identifying
  information: "Portions Copyright [year] [name of copyright owner]".

  Copyright 2011-2016 ForgeRock AS.
  Portions Copyright 2017-2025 3A Systems, LLC.
-->
<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>org.openidentityplatform.opendj</groupId>
    <artifactId>opendj-parent</artifactId>
    <version>4.9.2</version>
  </parent>
  <artifactId>opendj-server-legacy</artifactId>
  <packaging>jar</packaging>
  <name>OpenDJ Server</name>
  <description>
    This module provides the OpenDJ LDAP Directory Server.
  </description>
  <inceptionYear>2010</inceptionYear>

  <repositories>
    <repository>
      <id>oracle-repository</id>
      <name>Oracle Maven Repository</name>
      <url>http://download.oracle.com/maven</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <properties>
    <!-- General server-wide properties -->
    <docgen.dir>${project.build.directory}/docgen</docgen.dir>
    <jars.dir>${project.build.directory}/jars</jars.dir>

    <!-- Product information properties -->
    <patchFixIds />
    <isDebugBuild>false</isDebugBuild>
      <!-- Other properties -->
    <maven.build.timestamp.format>yyyyMMdd</maven.build.timestamp.format>

    <!-- Additional OSGI import package for this module -->
    <opendj.osgi.import.additional>
      org.forgerock.opendj.*;provide:=true,
      org.forgerock.json.*;provide:=true
    </opendj.osgi.import.additional>

    <product.archive.name>${product.name.lowercase}-${project.version}</product.archive.name>

    <juel.version>2.2.7</juel.version>
    
    <doclint>none</doclint>
    <opendmk.lib.dir>${basedir}/opendmk</opendmk.lib.dir>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.openidentityplatform.opendj</groupId>
      <artifactId>opendj-rest2ldap</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.i18n-framework</groupId>
      <artifactId>slf4j</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.opendj</groupId>
      <artifactId>opendj-config</artifactId>
    </dependency>
    
    <dependency>
      <groupId>org.openidentityplatform.opendj</groupId>
      <artifactId>opendj-cli</artifactId>
    </dependency>
    
     <dependency>
      <groupId>org.openidentityplatform.opendj</groupId>
      <artifactId>opendj-legacy</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.opendj</groupId>
      <artifactId>opendj-config</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.opendj</groupId>
      <artifactId>opendj-server</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.opendj</groupId>
      <artifactId>opendj-ldap-toolkit</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons</groupId>
      <artifactId>build-tools</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons</groupId>
      <artifactId>util</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons</groupId>
      <artifactId>json-resource</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons</groupId>
      <artifactId>json-resource-http</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.http-framework</groupId>
      <artifactId>core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.http-framework</groupId>
      <artifactId>grizzly</artifactId>
    </dependency>

    <!-- ForgeRock Common Audit libraries -->
    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-csv</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-json</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-elasticsearch</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-splunk</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-jms</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>json</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-syslog</artifactId>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-jdbc</artifactId>
    </dependency>

    <!-- slf4j libraries -->
<!--     <dependency> -->
<!--       <groupId>org.slf4j</groupId> -->
<!--       <artifactId>slf4j-jdk14</artifactId> -->
<!--     </dependency> -->

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
    </dependency>

       
    <!-- mail -->
    <dependency>
      <groupId>com.sun.mail</groupId>
      <artifactId>javax.mail</artifactId>
    </dependency>

    <dependency>
      <groupId>org.freemarker</groupId>
      <artifactId>freemarker</artifactId>
      <version>${freemarker.version}</version>
      <scope>test</scope>
    </dependency>

    <!-- Databases -->
    <dependency>
      <groupId>com.sleepycat</groupId>
      <artifactId>je</artifactId>
      <version>18.3.12</version>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.persistit</groupId>
      <artifactId>core</artifactId>
    </dependency>
	
    <dependency>
      <groupId>com.github.stephenc.jcip</groupId>
      <artifactId>jcip-annotations</artifactId>
    </dependency>

    <dependency>
      <groupId>de.odysseus.juel</groupId>
      <artifactId>juel-impl</artifactId>
      <version>${juel.version}</version>
    </dependency>

    <dependency>
      <groupId>de.odysseus.juel</groupId>
      <artifactId>juel-api</artifactId>
      <version>${juel.version}</version>
    </dependency>
    
    <dependency>
	    <groupId>com.datastax.oss</groupId>
	    <artifactId>java-driver-core</artifactId>
	    <version>4.17.0</version>
	    <exclusions>
	    	<exclusion>
	    		<groupId>org.reactivestreams</groupId>
	    		<artifactId>reactive-streams</artifactId>
	    	</exclusion>
	    </exclusions>
    </dependency>
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>42.7.4</version>
    </dependency>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <scope>test</scope>
    </dependency>
    <!-- TestContainers-->
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>cassandra</artifactId>
      <version>1.20.4</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>postgresql</artifactId>
      <version>1.20.4</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>oracle-free</artifactId>
      <version>1.20.4</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>mysql</artifactId>
      <version>1.20.4</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>mssqlserver</artifactId>
      <version>1.20.4</version>
      <scope>test</scope>
    </dependency>

    <!-- test JDBC drivers -->
    <dependency>
      <groupId>com.mysql</groupId>
      <artifactId>mysql-connector-j</artifactId>
      <version>9.2.0</version>
    </dependency>
    <dependency>
      <groupId>com.oracle.database.jdbc</groupId>
      <artifactId>ojdbc8</artifactId>
      <version>23.6.0.24.10</version>
    </dependency>
    <dependency>
      <groupId>com.microsoft.sqlserver</groupId>
      <artifactId>mssql-jdbc</artifactId>
      <version>12.8.1.jre8</version>
    </dependency>
  </dependencies>

  <build><finalName>${project.groupId}.${project.artifactId}</finalName>
    <resources>
      <!-- Main resources -->
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <excludes>
          <exclude>java-stubs/</exclude>
        </excludes>
      </resource>
      <!-- Property files used in test sources -->
      <resource>
        <directory>src/test/java</directory>
        <filtering>false</filtering>
        <includes>
          <include>**/*.properties</include>
        </includes>
      </resource>
      <!-- Images for quicksetup must be explicitely copied from sources -->
      <resource>
        <directory>src/quicksetup</directory>
        <filtering>false</filtering>
        <includes>
          <include>**/images/*.gif</include>
          <include>**/images/*.png</include>
        </includes>
      </resource>
      <!-- Images for guitools must be explicitely copied from sources -->
      <resource>
        <directory>src/guitools</directory>
        <filtering>false</filtering>
        <includes>
          <include>**/images/*.gif</include>
          <include>**/images/*.png</include>
        </includes>
      </resource>
      <!-- .plist files for macos must be filtered to include build properties -->
      <resource>
        <directory>resource/mac</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/Info.plist</include>
        </includes>
      </resource>
      <!-- Generation of DynamicConstants class from build properties -->
      <resource>
        <directory>src/main/resources/java-stubs</directory>
        <filtering>true</filtering>
        <targetPath>${project.build.directory}/java-stubs</targetPath>
      </resource>
    </resources>

    <pluginManagement>
      <plugins>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It
            has no influence on the Maven build itself. This section instructs Eclipse's
            Maven builder to invoke the antrun plugin for generating the configuration
            framework files, e.g. core.manifest, during a *clean* build. Execution
            during an incremental build is not supported. -->
        <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-antrun-plugin</artifactId>
                    <versionRange>[1.7,)</versionRange>
                    <goals>
                      <goal>run</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <execute>
                      <runOnIncremental>false</runOnIncremental>
                    </execute>
                  </action>
                </pluginExecution>
                <pluginExecution>
                	<pluginExecutionFilter>
                		<groupId>org.openidentityplatform.opendj</groupId>
                		<artifactId>opendj-maven-plugin</artifactId>
                		<versionRange>[4.0.0-SNAPSHOT,)</versionRange>
                		<goals>
                			<goal>generate-manifest</goal>
                			<goal>concat</goal>
                		</goals>
                	</pluginExecutionFilter>
                	<action>
                		<ignore />
                	</action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>

        <!-- Define template for jar generation -->
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <outputDirectory>${jars.dir}</outputDirectory>
            <finalName>${product.name.lowercase}</finalName>
            <archive>
              <addMavenDescriptor>false</addMavenDescriptor>
              <index>true</index>
            </archive>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <!-- Clean classes generated outside the build directory -->
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}/src</directory>
              <includes>
                <include>messages/generated/**</include>
              </includes>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
        </configuration>
      </plugin>

      <!-- Generate i18n messages -->
      <plugin>
        <groupId>org.openidentityplatform.commons.i18n-framework</groupId>
        <artifactId>maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>generate-messages</goal>
            </goals>
            <configuration>
              <resourceDirectory>${basedir}/src/messages</resourceDirectory>
              <targetDirectory>${basedir}/src/messages/generated/</targetDirectory>
              <force>true</force>
              <messageFiles>
                <!-- Warning: messageFile must contains at least one "/" -->
                <messageFile>org/opends/messages/access_control.properties</messageFile>
                <messageFile>org/opends/messages/admin.properties</messageFile>
                <messageFile>org/opends/messages/admin_tool.properties</messageFile>
                <messageFile>org/opends/messages/backend.properties</messageFile>
                <messageFile>org/opends/messages/config.properties</messageFile>
                <messageFile>org/opends/messages/core.properties</messageFile>
                <messageFile>org/opends/messages/extension.properties</messageFile>
                <messageFile>org/opends/messages/external.properties</messageFile>
                <messageFile>org/opends/messages/logger.properties</messageFile>
                <messageFile>org/opends/messages/plugin.properties</messageFile>
                <messageFile>org/opends/messages/protocol.properties</messageFile>
                <messageFile>org/opends/messages/quickSetup.properties</messageFile>
                <messageFile>org/opends/messages/replication.properties</messageFile>
                <messageFile>org/opends/messages/runtime.properties</messageFile>
                <messageFile>org/opends/messages/schema.properties</messageFile>
                <messageFile>org/opends/messages/task.properties</messageFile>
                <messageFile>org/opends/messages/tool.properties</messageFile>
                <messageFile>org/opends/messages/utility.properties</messageFile>
                <messageFile>org/opends/messages/version.properties</messageFile>
              </messageFiles>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <!-- Copy messages properties files for inclusion in main jar -->
          <execution>
            <id>copy-l10n-messages</id>
            <phase>validate</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}/org/opends/messages</outputDirectory>
              <resources>
                <resource>
                  <directory>src/messages/org/opends/messages</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-guitools-resources</id>
            <phase>validate</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}/org/opends/guitools</outputDirectory>
              <resources>
                <resource>
                  <directory>src/main/java/org/opends/guitools</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-quicksetup-resources</id>
            <phase>validate</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}/org/opends/quicksetup</outputDirectory>
              <resources>
                <resource>
                  <directory>src/main/java/org/opends/quicksetup</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.openidentityplatform.opendj</groupId>
        <artifactId>opendj-maven-plugin</artifactId>

        <executions>
          <execution>
            <id>generate-bootstrap-manifest</id>
            <goals>
              <goal>generate-manifest</goal>
            </goals>
            <configuration>
              <additionalJars>
                 <additionalJar>opendj-slf4j-adapter.jar</additionalJar>
                 <additionalJar>opendj-je-backend.jar</additionalJar>
              </additionalJars>
            </configuration>
          </execution>

          <execution>
            <id>generate-bootstrap-client-manifest</id>
            <goals>
              <goal>generate-manifest</goal>
            </goals>
            <configuration>
              <additionalJars>
              	<additionalJar>opendj-slf4j-adapter.jar</additionalJar>
                 <additionalJar>opendj-je-backend.jar</additionalJar>
              </additionalJars>
            </configuration>
          </execution>

          <!-- Create consolidated schema file for use in upgrade -->
          <execution>
            <id>creates-base-schema-files</id>
            <goals>
              <goal>concat</goal>
            </goals>
            <configuration>
              <schemaDirectory>${basedir}/resource/schema</schemaDirectory>
              <outputDirectory>${project.build.directory}/upgrade</outputDirectory>
              <outputFile>schema.ldif.${buildRevision}</outputFile>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>main-java-sources</id>
            <phase>process-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/messages/generated</source>
                <source>src/messages/src</source>
                <source>src/build-tools</source>
                <source>${project.build.directory}/java-stubs</source>
<!--                <source>../opendj-legacy/src/main/java</source>-->
              </sources>
            </configuration>
          </execution>
         </executions>
      </plugin>

      <!--
        Retrieve the SCM revision number and store it into the ${buildRevision} property
        and retrieve the build timestamp and store it into the ${buildDateTime} property
      -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
      </plugin>

      <!-- Compile unit tests -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <id>default-testCompile</id>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <testSourceDirectory>src/test/java</testSourceDirectory>
              <showDeprecation>false</showDeprecation>
              <showWarnings>false</showWarnings>
              <testCompilerArgument>-nowarn</testCompilerArgument>
              <testExcludes>
                <testExclude>**/org/opends/server/snmp/**</testExclude>
              </testExcludes>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Disable surefire plugin because all tests are run with failsafe plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <executions>
          <execution>
            <id>default-test</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <executions>
          <!-- Create opendj-slf4j-adapter manifest -->
          <execution>
            <id>opendj-slf4j-adapter-manifest</id>
            <goals>
              <goal>manifest</goal>
            </goals>
            <configuration>
              <buildDirectory>${project.build.directory}/slf4j-adapter-manifest/META-INF</buildDirectory>
              <manifestLocation>${project.build.directory}/slf4j-adapter-manifest/META-INF</manifestLocation>
              <instructions>
                <!-- Export only slf4j adapter -->
                <Export-Package>org.opends.server.loggers.slf4j</Export-Package>
                <Import-Package>
                  org.forgerock.i18n,
                  org.forgerock.i18n.slf4j,
                  org.opends.messages,
                  org.opends.server.loggers,
                  org.slf4j,
                  org.slf4j.helpers,
                  org.slf4j.spi
                </Import-Package>
              </instructions>
            </configuration>
          </execution>

          <!-- Create OpenDJ manifest -->
          <execution>
            <id>opendj-manifest</id>
            <goals>
              <goal>manifest</goal>
            </goals>
            <configuration>
              <instructions>
                <Bundle-Version>${project.version}</Bundle-Version>
                <Export-Package>org.forgerock.opendj.server.embedded</Export-Package>
                <!-- Import je changelog since it is not shipped in the main jar -->
                <Import-Package>
                  org.opends.server.replication.server.changelog.je;resolution:=optional,
                  com.sleepycat.je*;resolution:=optional,
                  ${opendj.osgi.import}
                </Import-Package>
                <Embed-Dependency>
                  org.openidentityplatform.commons.persistit:core,
                  <!--je,-->
                  jcip-annotations
                </Embed-Dependency>
              </instructions>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <!-- Package boostrap jar - contains only a manifest with classpath for the server -->
          <execution>
            <id>build-bootstrap-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>bootstrap</classifier>
              <includes>
                <include>nothing</include>
              </includes>
              <archive>
                <index>false</index>
                <manifestFile>${project.build.outputDirectory}/bootstrap/manifest-bootstrap</manifestFile>
              </archive>
            </configuration>
          </execution>

          <!-- Package boostrap-client jar - contains only a manifest with classpath for clients -->
          <execution>
            <id>build-bootstrap-client-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>bootstrap-client</classifier>
              <includes>
                <include>nothing</include>
              </includes>
              <archive>
                <index>false</index>
                <manifestFile>${project.build.outputDirectory}/bootstrap/manifest-bootstrap-client</manifestFile>
              </archive>
            </configuration>
          </execution>

          <!-- Package build-tools jar -->
          <execution>
            <id>create-build-tools-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>build-tools</classifier>
              <includes>
                <include>**/messages/Severity.class</include>
                <include>**/messages/Category.class</include>
                <include>**/messages/Message.class</include>
                <include>**/messages/MessagePropertyKey.class</include>
                <include>**/messages/MessageDescriptor.class</include>
                <include>**/server/types/PublicAPI.class</include>
                <include>**/server/types/StabilityLevel.class</include>
                <include>**/build/tools/*</include>
              </includes>
              <archive>
                <index>false</index>
              </archive>
            </configuration>
          </execution>

          <!-- Package quicksetup jar -->
          <execution>
            <id>build-quicksetup-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>quicksetup</classifier>
              <includes>
                <include>**/quicksetup/**</include>
                <include>**/org/opends/admin/ads/*</include>
                <include>**/org/opends/server/util/SetupUtils.class</include>
                <include>**/org/opends/server/util/CertificateManager.class</include>
                <include>**/org/opends/server/util/DynamicConstants.class</include>
                <include>**/org/opends/server/types/OperatingSystem.class</include>
                <include>**/org/opends/messages/Message.class</include>
                <include>**/org/opends/messages/MessageBuilder.class</include>
                <include>**/org/opends/messages/MessageDescriptor.class</include>
                <include>**/org/opends/messages/Severity.class</include>
                <include>**/org/opends/messages/Category.class</include>
                <include>**/org/opends/messages/QuickSetupMessages.class</include>
                <include>**/org/opends/server/types/OpenDsException.class</include>
              </includes>
              <archive>
                <index>false</index>
              </archive>
            </configuration>
          </execution>

          <!-- Package OpenDJ SL4J Logger Adapter jar -->
          <execution>
            <id>build-opendj-slf4j-adapter-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>slf4j-adapter</classifier>
              <includes>
                <include>**/org/slf4j/**</include>
                <include>**/org/opends/server/loggers/slf4j/**</include>
              </includes>
              <archive>
                <index>false</index>
                <manifestFile>${project.build.directory}/slf4j-adapter-manifest/META-INF/MANIFEST.MF</manifestFile>
              </archive>
            </configuration>
          </execution>

          <!-- Package JE backend jar -->
          <execution>
            <id>build-opendj-je-backend-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>je-backend</classifier>
              <includes>
                <include>org/opends/server/backends/jeb/**</include>
                <include>org/opends/server/replication/server/changelog/je/**</include>
              </includes>
              <archive>
                <index>false</index>
              </archive>
            </configuration>
          </execution>

          <!-- Build localized jars (one per supported locale) -->
          <!-- (is there a way to avoid all these repeated executions ?) -->
          <execution>
            <id>build-caES-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>${localized.jars.classifier}-ca_ES</classifier>
              <includes>
                <include>**/*_ca_ES.properties</include>
              </includes>
            </configuration>
          </execution>

          <execution>
            <id>build-de-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>${localized.jars.classifier}-de</classifier>
              <includes>
                <include>**/*_de.properties</include>
              </includes>
            </configuration>
          </execution>

          <execution>
            <id>build-es-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>${localized.jars.classifier}-es</classifier>
              <includes>
                <include>**/*_es.properties</include>
              </includes>
            </configuration>
          </execution>

          <execution>
            <id>build-fr-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>${localized.jars.classifier}-fr</classifier>
              <includes>
                <include>**/*_fr.properties</include>
              </includes>
            </configuration>
          </execution>

          <execution>
            <id>build-ja-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>${localized.jars.classifier}-ja</classifier>
              <includes>
                <include>**/*_ja.properties</include>
              </includes>
            </configuration>
          </execution>

          <execution>
            <id>build-ko-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>${localized.jars.classifier}-ko</classifier>
              <includes>
                <include>**/*_ko.properties</include>
              </includes>
            </configuration>
          </execution>

          <execution>
            <id>build-pl-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>${localized.jars.classifier}-pl</classifier>
              <includes>
                <include>**/*_pl.properties</include>
              </includes>
            </configuration>
          </execution>

          <execution>
            <id>build-zh-CN-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>${localized.jars.classifier}-zh_CN</classifier>
              <includes>
                <include>**/*_zh_CN.properties</include>
              </includes>
            </configuration>
          </execution>

          <execution>
            <id>build-zh-TW-jar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>${localized.jars.classifier}-zh_TW</classifier>
              <includes>
                <include>**/*_zh_TW.properties</include>
              </includes>
            </configuration>
          </execution>

          <!-- Main jar -->
          <execution>
            <id>default-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <excludes>
                <exclude>*.app/**</exclude>
                <exclude>java-stubs/**</exclude>
                <exclude>bootstrap/**</exclude>
                <exclude>META-INF/**</exclude>
                <exclude>**/*_ca_ES.properties</exclude>
                <exclude>**/*_de.properties</exclude>
                <exclude>**/*_es.properties</exclude>
                <exclude>**/*_fr.properties</exclude>
                <exclude>**/*_ja.properties</exclude>
                <exclude>**/*_ko.properties</exclude>
                <exclude>**/*_pl.properties</exclude>
                <exclude>**/*_zh_CN.properties</exclude>
                <exclude>**/*_zh_TW.properties</exclude>
                <exclude>org/slf4j/**</exclude>
                <exclude>org/opends/server/loggers/slf4j/OpenDJLogger*</exclude>
<!--                 <exclude>org/opends/server/backends/jeb/**</exclude> -->
<!--                 <exclude>org/opends/server/replication/server/changelog/je/**</exclude> -->
              </excludes>
              <archive>
                <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
              </archive>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Unpack files from OpenDJ standard archive -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-archive</id>
            <phase>package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.openidentityplatform.opendj</groupId>
                  <artifactId>opendj-ldap-toolkit</artifactId>
                  <version>${project.version}</version>
                  <type>zip</type>
                  <overWrite>true</overWrite>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <!-- Creates the archive folder -->
          <execution>
            <id>build-opendj-archive</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <finalName>${product.name.lowercase}</finalName>
              <outputDirectory>${project.build.directory}/package</outputDirectory>
              <appendAssemblyId>false</appendAssemblyId>
              <attach>false</attach>
              <descriptors>
                <descriptor>src/main/assembly/opendj-archive-assembly.xml</descriptor>
              </descriptors>
              <formats>
                <format>dir</format>
              </formats>
              <archive>
                <manifestFile>${project.build.outputDirectory}/bootstrap/manifest-bootstrap</manifestFile>
              </archive>
            </configuration>
          </execution>

          <!-- Creates the archive folder -->
          <execution>
            <id>build-example-plugin.zip</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <finalName>example-plugin</finalName>
              <outputDirectory>${project.build.directory}/package/${product.name.lowercase}/</outputDirectory>
              <appendAssemblyId>false</appendAssemblyId>
              <attach>false</attach>
              <descriptors>
                <descriptor>src/main/assembly/example-plugin-assembly.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <!-- Copy config.ldif in build dir (needed if snmp config merge is needed) -->
            <id>copy-config-ldif</id>
            <phase>generate-resources</phase>
            <configuration>
              <target>
                <copy todir="${project.build.directory}/template/config" file="${basedir}/resource/config/config.ldif" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>

          <!-- Generate final zip and attach artefact -->
          <execution>
            <id>attach-artifact</id>
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <zip destfile="${project.build.directory}/package/${product.archive.name}.zip">
                  <zipfileset dir="${project.build.directory}/package/${product.name.lowercase}" includes="**/*" excludes="bin/*,template/**/*,lib/_client-script.sh,lib/_script-util.sh,lib/_server-script.sh,lib/_mixed-script.sh,setup,uninstall,upgrade,QuickSetup.app/Contents/MacOS/universalJavaApplicationStub,Uninstall.app/Contents/MacOS/universalJavaApplicationStub,bin/ControlPanel.app/Contents/MacOS/universalJavaApplicationStub" filemode="644" dirmode="755" prefix="opendj" />
                  <zipfileset dir="${project.build.directory}/package/${product.name.lowercase}" includes="lib/_client-script.sh,lib/_script-util.sh,lib/_server-script.sh,lib/_mixed-script.sh" filemode="755" dirmode="755" prefix="opendj" />
                  <zipfileset dir="${project.build.directory}/package/${product.name.lowercase}" includes="bin/*" filemode="755" dirmode="755" prefix="opendj" />
                  <zipfileset dir="${project.build.directory}/package/${product.name.lowercase}" includes="setup,uninstall,upgrade,QuickSetup.app/Contents/MacOS/universalJavaApplicationStub,Uninstall.app/Contents/MacOS/universalJavaApplicationStub,bin/ControlPanel.app/Contents/MacOS/universalJavaApplicationStub" filemode="755" dirmode="755" prefix="opendj" />
                  <zipfileset dir="${project.build.directory}/package/${product.name.lowercase}" includes="template/**/*" filemode="444" dirmode="744" prefix="opendj" />
                </zip>
                <attachartifact file="${project.build.directory}/package/${product.archive.name}.zip" type="zip" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Release project -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <!-- Required for release:perform: the parent pom specifies a value
            for "arguments" in the plugin configuration. This prevents command line setting
            of the option. -->
          <arguments>-Penforce -Dopendmk.lib.dir=${opendmk.lib.dir}</arguments>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <configuration>
            <skip>true</skip>
        </configuration>
        </plugin>
    </plugins>
  </build>

  <profiles>
    <!--
       Profile to run precommit tasks: checkstyle, copyright (TODO), SVN eol check (TODO),
       unit-tests

       Tests are not run by default due to running time (average of 8-10 minutes).
    -->
    <profile>
      <id>precommit</id>
      <build><finalName>${project.groupId}.${project.artifactId}</finalName>
        <plugins>

<!--           Enforce Checkstyle -->
<!--           <plugin> -->
<!--             <groupId>org.apache.maven.plugins</groupId> -->
<!--             <artifactId>maven-checkstyle-plugin</artifactId> -->
<!--             <executions> -->
<!--               Disable default from parent -->
<!--               <execution> -->
<!--                 <id>check-src-and-tests</id> -->
<!--                 <phase>none</phase> -->
<!--                 <goals> -->
<!--                   <goal>checkstyle</goal> -->
<!--                 </goals> -->
<!--               </execution> -->
<!--               <execution> -->
<!--                 <id>check-src-and-tests-alternative</id> -->
<!--                 <configuration> -->
<!--                   <excludes>generated/org/opends/server/snmp/**,org/opends/messages/**</excludes> -->
<!--                   <configLocation>${project.build.outputDirectory}/org/forgerock/checkstyle/opends-checkstyle.xml</configLocation> -->
<!--                   <headerLocation>${checkstyleHeaderLocation}</headerLocation> -->
<!--                   <suppressionsLocation>${project.build.outputDirectory}/org/forgerock/checkstyle/unit-test-suppressions.xml</suppressionsLocation> -->
<!--                   <includeTestSourceDirectory>true</includeTestSourceDirectory> -->
<!--                   <includeResources>false</includeResources> -->
<!--                   Only output errors if we're not expecting any -->
<!--                   <consoleOutput>${checkstyleFailOnError}</consoleOutput> -->
<!--                   <failsOnError>${checkstyleFailOnError}</failsOnError> -->
<!--                 </configuration> -->
<!--                 <phase>process-test-classes</phase> -->
<!--                 <goals> -->
<!--                   <goal>check</goal> -->
<!--                 </goals> -->
<!--               </execution> -->
<!--             </executions> -->
<!--          </plugin> -->

          <!--
             Run unit/integration tests.

             A lot of existing tests requires a running server, which is why the tests are
             run using failsafe instead of surefire.

             It should be possible in the future to separate tests into unit (no server) and
             integration (with server), by using respectively surefire and failsafe plugin
             to run them, but it will require identifying them.
             We could use an "unit" marker in TestNG groups to do so.
          -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
<!--            	<classpathDependencyExcludes>-->
<!--	            	<classpathDependencyExcludes>org.slf4j:slf4j-jdk14</classpathDependencyExcludes>-->
<!--	          	</classpathDependencyExcludes>-->
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
				  <additionalClasspathElements>
		            <additionalClasspathElement>${project.build.directory}/jars/opendj-slf4j-adapter.jar</additionalClasspathElement>
		          </additionalClasspathElements>
				  <testSourceDirectory>src/test/java</testSourceDirectory>
<!--				  <enableProcessChecker>all</enableProcessChecker>-->
				  <forkedProcessTimeoutInSeconds>900</forkedProcessTimeoutInSeconds>
                  <forkedProcessExitTimeoutInSeconds>120</forkedProcessExitTimeoutInSeconds>
                  <excludes>
                    <exclude>org/opends/server/snmp/**</exclude>
                    <exclude>org/opends/quicksetup/**</exclude>
                    <exclude>org/opends/quicksetup/**</exclude>
                  </excludes>
                  <includes>
                    <include>**/Test*.java</include>
                    <include>**/*Test.java</include>
                    <include>**/*Tests.java</include>
                    <include>**/*TestCase.java</include>
                    <include>**/*TestCases.java</include>
                  </includes>
                  <properties>
                    <property>
                      <name>usedefaultlisteners</name>
                      <value>false</value>
                    </property>
                    <property>
                      <name>listener</name>
                      <value>org.opends.server.TestListener</value>
                    </property>
                    <property>
                      <name>excludegroups</name>
                      <value>slow</value>
                    </property>
                    <property>
                      <name>configfailurepolicy</name>
                      <value>skip</value>
                    </property>
                 </properties>
                 <systemPropertyVariables>
                    <org.opends.server.BuildRoot>${basedir}</org.opends.server.BuildRoot>
                    <org.opends.server.BuildDir>${project.build.directory}</org.opends.server.BuildDir>
                    <org.opends.test.replicationDbImpl>LOG</org.opends.test.replicationDbImpl>
                    <jvmarg value="-Dorg.opends.server.snmp.opendmk=${opendmk.lib.dir}" />
                    <org.opends.server.CleanupDirectories>true</org.opends.server.CleanupDirectories>
                    <org.opends.test.suppressOutput>true</org.opends.test.suppressOutput>
                    <org.opends.test.pauseOnFailure>false</org.opends.test.pauseOnFailure>
                    <org.opends.test.copyClassesToTestPackage>false</org.opends.test.copyClassesToTestPackage>
                  </systemPropertyVariables>
                  <argLine>@{argLine}</argLine>
	          	  <reuseForks>false</reuseForks>
	          	  <forkCount>1</forkCount>
	          	  <parallel>none</parallel>
	          	  <runOrder>alphabetical</runOrder>
	          	  <rerunFailingTestsCount>3</rerunFailingTestsCount>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!--
      Profile to build SNMP extension.

      This profile is only actived when command line contains the 'opendmk.lib.dir'
      property that must point to the directory where OpenDMK jars are located.
       <opendmk.lib.dir>${basedir}/opendmk</opendmk.lib.dir>
    -->
    <profile>
      <id>snmp</id>
      <activation>
       	<file>
       		<exists>${opendmk.lib.dir}/jdmkrt.jar</exists>
       	</file>
      </activation>

      <properties>
        <snmp.dir>${basedir}/src/snmp</snmp.dir>
        <snmp.gen.dir>${snmp.dir}/generated</snmp.gen.dir>
        <snmp.mib.dir>${snmp.dir}/resource/mib</snmp.mib.dir>
        <snmp.jar.name>snmp-mib2605</snmp.jar.name>
      </properties>

      <dependencies>
        <dependency>
          <groupId>opendmk</groupId>
          <artifactId>jdmkrt</artifactId>
          <version>1.0</version>
          <scope>system</scope>
          <systemPath>${opendmk.lib.dir}/jdmkrt.jar</systemPath>
        </dependency>
        <dependency>
          <groupId>opendmk</groupId>
          <artifactId>jdmktk</artifactId>
          <version>1.0</version>
          <scope>system</scope>
          <systemPath>${opendmk.lib.dir}/jdmktk.jar</systemPath>
        </dependency>
      </dependencies>

      <build><finalName>${project.groupId}.${project.artifactId}</finalName>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <!-- Add snmp source directory and snmp generated directory as sources -->
              <execution>
                <id>snmp-java-sources</id>
               <phase>process-sources</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/snmp/generated</source>
                    <source>src/snmp/src</source>
                     <source>src/snmp/resource</source>
                  </sources>
                </configuration>
              </execution>
             
            </executions>
          </plugin>

          <!-- Cleans SNMP directory -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>createMibDir</id>
                <phase>initialize</phase>
                <configuration>
                  <target>
                    <delete dir="${snmp.gen.dir}/org/opends/server/snmp" />
                    <mkdir dir="${snmp.gen.dir}/org/opends/server/snmp" />
                  </target>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
              <execution>
                <!-- Append snmp config to the config.ldif -->
                <id>generate-config-ldif</id>
                <phase>prepare-package</phase>
                <configuration>
                  <target>
                    <concat destfile="${project.build.directory}/template/config/config.ldif" append="true">
                      <filelist dir="${snmp.dir}/resource/config" files="config.snmp.ldif" />
                    </concat>
                  </target>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- MIB generation -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.3.2</version>
            <executions>
              <execution>
                <id>mib-generation</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>java</executable>
                  <classpathScope>compile</classpathScope>
                  <arguments>
                    <argument>-classpath</argument>
                    <classpath />
                    <argument>com.sun.jdmk.tools.MibGen</argument>
                    <argument>-X:use-display-hint</argument>
                    <argument>-d</argument>
                    <argument>${snmp.gen.dir}/org/opends/server/snmp</argument>
                    <argument>-mc</argument>
                    <argument>-desc</argument>
                    <argument>-tp</argument>
                    <argument>org.opends.server.snmp</argument>
                    <argument>${snmp.mib.dir}/rfc2605.txt</argument>
                    <argument>${snmp.mib.dir}/mib_core.txt</argument>
                    <argument>${snmp.mib.dir}/rfc2021.txt</argument>
                    <argument>${snmp.mib.dir}/rfc2788.txt</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <!-- Package snmp jar -->
              <execution>
                <id>build-snmp-jar</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <outputDirectory>${jars.dir}</outputDirectory>
                  <finalName>${snmp.jar.name}</finalName>
                  <attach>false</attach>
                  <descriptors>
                    <descriptor>src/main/assembly/snmp-jar-assembly.xml</descriptor>
                  </descriptors>
                  <appendAssemblyId>false</appendAssemblyId>
                  <formats>
                    <format>jar</format>
                  </formats>
                  <archive>
                    <index>true</index>
                    <addMavenDescriptor>false</addMavenDescriptor>
                    <manifestEntries>
                      <Extension-Name>${snmp.jar.name}</Extension-Name>
                      <Implementation-Version>${project.version}</Implementation-Version>
                      <Revision-Number>${buildRevision}</Revision-Number>
                    </manifestEntries>
                  </archive>
                </configuration>
              </execution>

              <!-- Package the final zip -->
              <execution>
                <id>build-opendj-archive</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/package</outputDirectory>
                  <finalName>${product.name.lowercase}</finalName>
                  <descriptors>
                    <descriptor>src/main/assembly/opendj-snmp-archive-assembly.xml</descriptor>
                  </descriptors>
                  <appendAssemblyId>false</appendAssemblyId>
                  <formats>
                    <format>dir</format>
                  </formats>
                  <archive>
                    <manifestFile>${project.build.outputDirectory}/bootstrap/manifest-bootstrap</manifestFile>
                  </archive>
                </configuration>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>

  </profiles>

</project>
