<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.societegenerale.ci-droid.tasks-consumer</groupId>
    <artifactId>ci-droid-tasks-consumer-parent</artifactId>
    <name>ci-droid-tasks-consumer Service</name>

    <version>2.0.0</version>

    <packaging>pom</packaging>

    <description>consumer part of CI-droid</description>
    <url>https://github.com/societe-generale/ci-droid-tasks-consumer</url>

    <developers>
        <developer>
            <id>vincent-fuchs</id>
            <name>Vincent FUCHS</name>
            <email>vincent.fuchs@gmail.com</email>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <repositories>
        <repository>
            <id>maven central</id>
            <url>https://repo.maven.apache.org/maven2/</url>
        </repository>

        <repository>
            <id>Spring milestones</id>
            <url>https://repo.spring.io/milestone/</url>
        </repository>
    </repositories>

    <pluginRepositories>

        <pluginRepository>
            <id>maven central</id>
            <url>https://repo.maven.apache.org/maven2/</url>
        </pluginRepository>

        <pluginRepository>
            <id>Spring milestones</id>
            <url>https://repo.spring.io/milestone/</url>
        </pluginRepository>
    </pluginRepositories>

    <issueManagement>
        <url>https://github.com/societe-generale/ci-droid-tasks-consumer/issues</url>
        <system>GitHub</system>
    </issueManagement>

    <properties>

        <!-- Compiling -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>11</java.version>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>

        <spring-cloud.version>2021.0.1</spring-cloud.version>

        <commons-io.version>2.11.0</commons-io.version>
        <ant-style-path-matcher.version>1.0.0</ant-style-path-matcher.version>
        <logback-classic.version>1.2.11</logback-classic.version>
        <logstash-logback-encoder.version>7.0.1</logstash-logback-encoder.version>
        <janino.version>3.1.6</janino.version>
        <jgit.version>6.1.0.202203080745-r</jgit.version>
        <commons-lang3.version>3.12.0</commons-lang3.version>

        <mockserver.version>5.5.1</mockserver.version>
        <awaitility.version>4.2.0</awaitility.version>
        <greenmail.version>1.6.8</greenmail.version>
        <validation-api.version>2.0.1.Final</validation-api.version>

        <jacoco.version>0.8.2</jacoco.version>
        <guava.version>31.0.1-jre</guava.version>
        <springdoc.version>1.6.6</springdoc.version>


        <ci-droid-api.version>1.0.6</ci-droid-api.version>
        <ci-droid-extensions.version>1.0.10</ci-droid-extensions.version>
    </properties>

    <!-- required by maven-release-plugin -->
    <scm>
        <url>https://github.com/societe-generale/ci-droid-tasks-consumer</url>
        <connection>scm:git:git@github.com:societe-generale/ci-droid-tasks-consumer.git</connection>
        <developerConnection>scm:git:git@github.com:societe-generale/ci-droid-tasks-consumer.git</developerConnection>
        <tag>cidroid-tasks-consumer_2.0.0</tag>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.6</version>
    </parent>

    <modules>
        <module>ci-droid-tasks-consumer-services</module>
        <module>ci-droid-tasks-consumer-infrastructure</module>
        <module>ci-droid-tasks-consumer-gitlab-adapter</module>
        <module>ci-droid-tasks-consumer-azure-devops-adapter</module>
        <module>ci-droid-tasks-consumer-github-adapter</module>
        <module>ci-droid-tasks-consumer-autoconfigure</module>
        <module>ci-droid-tasks-consumer-starter</module>
    </modules>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>io.github.azagniotov</groupId>
                <artifactId>ant-style-path-matcher</artifactId>
                <version>${ant-style-path-matcher.version}</version>
            </dependency>

            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback-classic.version}</version>
            </dependency>

            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>${validation-api.version}</version>
            </dependency>

            <!-- Test -->

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

            <dependency>
                <groupId>com.icegreen</groupId>
                <artifactId>greenmail</artifactId>
                <version>${greenmail.version}</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>net.logstash.logback</groupId>
                <artifactId>logstash-logback-encoder</artifactId>
                <version>${logstash-logback-encoder.version}</version>
            </dependency>

            <!-- for conditional logging with logback -->
            <dependency>
                <groupId>org.codehaus.janino</groupId>
                <artifactId>janino</artifactId>
            </dependency>

            <dependency>
                <groupId>org.eclipse.jgit</groupId>
                <artifactId>org.eclipse.jgit</artifactId>
                <version>${jgit.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons-lang3.version}</version>
            </dependency>

            <dependency>
                <groupId>org.mock-server</groupId>
                <artifactId>mockserver-netty</artifactId>
                <version>${mockserver.version}</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>



            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons-io.version}</version>
            </dependency>

            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>


        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>3.0.2</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <resources>
            <resource>
                <includes>
                    <include>**/*</include>
                </includes>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <stagingRepository>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</stagingRepository>
                    <tagNameFormat>cidroid-tasks-consumer_@{project.version}</tagNameFormat>
                    <localCheckout>true</localCheckout>
                    <pushChanges>false</pushChanges>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>makeRelease</releaseProfiles>
                    <mavenExecutorId>forked-path</mavenExecutorId>
                </configuration>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.4.1</version>
                <configuration>
                    <rules>
                        <dependencyConvergence />
                    </rules>
                    <fail>false</fail>
                </configuration>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- Sets the VM argument line used when unit tests are run. -->
                    <argLine>${surefireArgLine}</argLine>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <argLine>${failsafeArgLine}</argLine>
                    <includes>
                        <include>**/*IT.java</include>
                    </includes>
                    <testFailureIgnore>false</testFailureIgnore>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <id>pre-unit-tests</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <propertyName>surefireArgLine</propertyName>
                            <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
                        </configuration>
                    </execution>

                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains the execution data. -->
                            <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                            <!-- Sets the output directory for the code coverage report. -->
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                        </configuration>
                    </execution>

                    <execution>
                        <id>pre-integration-tests</id>
                        <goals>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                        <configuration>
                            <propertyName>failsafeArgLine</propertyName>
                            <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
                        </configuration>
                    </execution>

                    <execution>
                        <id>post-integration-test</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains the execution data. -->
                            <dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>
                            <!-- Sets the output directory for the code coverage report. -->
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
                        </configuration>
                    </execution>

                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.eluder.coveralls</groupId>
                <artifactId>coveralls-maven-plugin</artifactId>
                <version>4.3.0</version>

                <configuration>
                    <relativeReportDirs>
                        <relativeReportDir>/jacoco-it</relativeReportDir>
                        <relativeReportDir>/jacoco-ut</relativeReportDir>
                    </relativeReportDirs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.societegenerale.commons</groupId>
                <artifactId>arch-unit-maven-plugin</artifactId>
                <version>2.7.2</version>
                <configuration>
                    <rules>
                        <preConfiguredRules>
                            <rule>com.societegenerale.commons.plugin.rules.NoStandardStreamRuleTest</rule>
                            <rule>com.societegenerale.commons.plugin.rules.NoJunitAssertRuleTest</rule>
                            <rule>com.societegenerale.commons.plugin.rules.NoJodaTimeRuleTest</rule>
                            <rule>com.societegenerale.commons.plugin.rules.NoJavaUtilDateRuleTest</rule>
                            <rule>com.societegenerale.commons.plugin.rules.NoPowerMockRuleTest</rule>
                            <rule>com.societegenerale.commons.plugin.rules.NoPrefixForInterfacesRuleTest</rule>
                            <rule>com.societegenerale.commons.plugin.rules.DontReturnNullCollectionTest</rule>

                            <rule>com.societegenerale.commons.plugin.rules.NoInjectedFieldTest</rule>
                            <rule>com.societegenerale.commons.plugin.rules.NoAutowiredFieldTest</rule>
                        </preConfiguredRules>
                    </rules>
                </configuration>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>arch-test</goal>
                        </goals>
                    </execution>
                </executions>

            </plugin>

        </plugins>


        <pluginManagement>
            <plugins>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <configuration>
                        <includes>
                            <include>**/*IT.java</include>
                        </includes>
                        <testFailureIgnore>false</testFailureIgnore>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>makeRelease</id>

            <build>
                <plugins>

                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>

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


                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <encoding>UTF-8</encoding>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
