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

    <!--
        Ce projet n'utilise pas Spring. Il herite de spring-boot-dependencies uniquement pour simplifier la
        gestion des versions des plugins et des dependances.
      -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.1.2.RELEASE</version>
    </parent>

    <groupId>ch.ge.etat.securite</groupId>
    <artifactId>gina-ldap-client</artifactId>
    <name>gina-ldap-client</name>
    <version>4.0.0</version>

    <url>https://prod.etat-ge.ch/wikiadm/x/ZABdPg</url>

    <properties>
        <!-- versions des plugins -->
        <javacoco-maven-plugin.version>0.8.2</javacoco-maven-plugin.version>

        <!-- versions des JAR -->
        <assertj.version>3.11.1</assertj.version>
        <junit-toolbox.version>1.11</junit-toolbox.version>

        <!-- autres proprietes -->
        <sonar.jacoco.reportPaths>target/jacoco.exec</sonar.jacoco.reportPaths>
    </properties>

    <ciManagement>
        <system>jenkins</system>
        <url>https://prod.etat-ge.ch/jenkins_act/job/gina-ldap-client</url>
    </ciManagement>

    <issueManagement>
        <system>jira</system>
        <url>https://prod.etat-ge.ch/csbugtrack/projects/GINALDAPCLIENT</url>
    </issueManagement>

    <scm>
        <connection>scm:git:https://prod.etat-ge.ch/gitlab/DEVELOPPEUR-EDG/Securite/gina-ldap-client.git</connection>
        <developerConnection>scm:git:https://prod.etat-ge.ch/gitlab/DEVELOPPEUR-EDG/Securite/gina-ldap-client.git</developerConnection>
        <url>https://prod.etat-ge.ch/gitlab/DEVELOPPEUR-EDG/Securite/gina-ldap-client.git</url>
      <tag>gina-ldap-client-4.0.0</tag>
  </scm>

    <dependencies>
        <!-- Compile dependencies -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.googlecode.junit-toolbox</groupId>
            <artifactId>junit-toolbox</artifactId>
            <version>${junit-toolbox.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <encoding>ISO-8859-1</encoding>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <!-- Tests : connexion à Gina ou au serveur ldif. Les valeurs à fournir sont indiquees dans les profils
                 en bas de ce fichier.
              -->
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <test.gestrepo.server>${ldap.gestrepo.server}</test.gestrepo.server>
                        <test.gestrepo.user>${ldap.gestrepo.user}</test.gestrepo.user>
                        <test.gestrepo.password>${ldap.gestrepo.password}</test.gestrepo.password>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <!-- Java 8 est devenu trop sourcilleux avec la javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <additionalJOption>-Xdoclint:none</additionalJOption>
                </configuration>
            </plugin>
            <!-- Couverture de code par les tests unitaires, pour SonarQube -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${javacoco-maven-plugin.version}</version>
                <configuration>
                    <append>true</append>
                    <destFile>${sonar.jacoco.reportPaths}</destFile>
                </configuration>
                <executions>
                    <execution>
                        <id>agent-for-unit-tests</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jacoco-site</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- Profil avec acces au depot Nexus de l'Etat de Geneve et a Gina.
                 Ce profil est recommande pour quelqu'un d'interne au reseau de l'Etat.
              -->
            <id>etat-de-geneve</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- Les valeurs des proprietes listees plus haut dans la section <systemPropertyVariables> doivent
                     etre fournies de facon externe, par exemple par des options -D dans la ligne de commande mvn.
                     Elles sont a trouver dans le wiki.
                  -->
            </properties>
            <distributionManagement>
                <repository>
                    <id>internal.project.release</id>
                    <url>http://ctinexus.prod.etat-ge.ch:23000/ctinexus/content/repositories/project_release</url>
                </repository>
                <snapshotRepository>
                    <id>internal.project.snapshot</id>
                    <url>http://ctinexus.prod.etat-ge.ch:23000/ctinexus/content/repositories/project_snapshot</url>
                </snapshotRepository>
            </distributionManagement>
        </profile>
        <profile>
            <!-- Profil pour execution de Maven en mode autonome, sans acces ni a Nexus, ni a Gina.
                 Pour les tests JUnit, requiert le lancement prealable de trois petits servers LDAP UnboundID. Voir le
                 fichier README.md.
                 Ce profil est recommande pour quelqu'un d'externe au reseau de l'Etat.
              -->
            <id>local</id>
            <properties>
                <ldap.gestrepo.server>ldap://127.0.0.1:30636</ldap.gestrepo.server>
                <ldap.gestrepo.user />
                <ldap.gestrepo.password />
            </properties>
        </profile>
        <profile>
            <!-- Profil special, pour deployer les JAR sur Maven Central, via OSSRH -->
            <id>maven-central</id>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
                </repository>
            </distributionManagement>
            <build>
                <plugins>
                    <!-- Deployer egalement un JAR contenant les sources (exige par Sonatype) -->
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Deployer egalement un JAR contenant la javadoc (exige par Sonatype) -->
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Signer les livrables via GPG (exige par Sonatype)
                         Ne fonctionne pas en local, uniquement depuis le serveur Jenkins.
                         La valeur de "gpg.keyname" est fournie dans le fichier settings.xml du serveur Jenkins.
                      -->
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>${gpg.keyname}</keyname>
                                    <passphraseServerId>${gpg.keyname}</passphraseServerId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
