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

    <groupId>org.jqassistant.plugin</groupId>
    <artifactId>common-parent</artifactId>
    <version>2.3.0</version>
    <packaging>pom</packaging>

    <name>jQAssistant Plugin Common Parent</name>
    <description>Parent POM for jQAssistant common modules.</description>
    <url>https://github.com/jqassistant-plugin/jqassistant-plugin-common</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <com.buschmais.jqassistant.version>2.3.0</com.buschmais.jqassistant.version>
        <org.slf4j.version>1.7.36</org.slf4j.version>
        <org.projectlombok.version>1.18.32</org.projectlombok.version>
        <org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
        <lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
        <maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
        <maven-invoker-plugin.version>3.6.1</maven-invoker-plugin.version>
        <maven-javadoc-plugin.version>3.4.0</maven-javadoc-plugin.version>
        <maven-source-plugin.version>3.3.0</maven-source-plugin.version>
        <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <cyclonedx-maven-plugin.version>2.8.0</cyclonedx-maven-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
        <!-- integration tests -->
        <it.jqassistant.store.uri>memory:///</it.jqassistant.store.uri>
    </properties>

    <organization>
        <name>jQAssistant</name>
        <url>http://jqassistant.org</url>
    </organization>

    <developers>
        <developer>
            <id>dirk-mahler</id>
            <name>Dirk Mahler</name>
            <email>dirk.mahler@buschmais.com</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/jqassistant-plugin/jqassistant-plugin-common.git</connection>
        <developerConnection>scm:git:https://github.com/jqassistant-plugin/jqassistant-plugin-common.git
        </developerConnection>
        <url>https://github.com/jqassistant-plugin/jqassistant-plugin-common</url>
        <tag>2.3.0</tag>
    </scm>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-staging</id>
            <name>Nexus Release Repository</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <build>
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <includes>
                    <include>META-INF/jqassistant-plugin.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <excludes>
                    <exclude>META-INF/jqassistant-plugin.xml</exclude>
                </excludes>
                <filtering>false</filtering>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.buschmais.jqassistant</groupId>
                    <artifactId>jqassistant-maven-plugin</artifactId>
                    <version>${com.buschmais.jqassistant.version}</version>
                    <executions>
                        <execution>
                            <id>default-cli</id>
                            <goals>
                                <goal>scan</goal>
                                <goal>analyze</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <yaml>
                            jqassistant:
                              maven:
                                reuse-store: false
                              scan:
                                properties:
                                  xml.file.include: /META-INF/jqassistant-plugin.xml
                              analyze:
                                rule:
                                  default-concept-severity: INFO
                        </yaml>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <release>11</release>
                        <annotationProcessorPaths>
                            <path>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                                <version>${org.projectlombok.version}</version>
                            </path>
                            <dependency>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok-mapstruct-binding</artifactId>
                                <version>0.2.0</version>
                            </dependency>
                            <path>
                                <groupId>org.mapstruct</groupId>
                                <artifactId>mapstruct-processor</artifactId>
                                <version>${org.mapstruct.version}</version>
                            </path>
                        </annotationProcessorPaths>
                        <compilerArgs>
                            <arg>-Amapstruct.unmappedTargetPolicy=ERROR</arg>
                            <arg>-Amapstruct.unmappedSourcePolicy=ERROR</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <detectJavaApiLink>false</detectJavaApiLink>
                        <doclint>none</doclint>
                        <sourcepath>${project.build.directory}/generated-sources/delombok;${project.basedir}/src/main/java;${project.build.directory}/generated-sources/xjc</sourcepath>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.5.0</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.7.0.1746</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.0.1</version>
                    <configuration>
                        <mavenExecutorId>forked-path</mavenExecutorId>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <tagNameFormat>@{version}</tagNameFormat>
                        <goals>deploy</goals>
                        <releaseProfiles>release</releaseProfiles>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <includes>
                            <include>**/*Test.java</include>
                        </includes>
                        <systemPropertyVariables>
                            <!-- default store to use for Integration tests -->
                            <jqassistant.store.uri>${it.jqassistant.store.uri}</jqassistant.store.uri>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                            <configuration>
                                <includes>
                                    <include>**/*IT.java</include>
                                </includes>
                                <systemPropertyVariables>
                                    <!-- default store to use for Integration tests -->
                                    <jqassistant.store.uri>${it.jqassistant.store.uri}</jqassistant.store.uri>
                                </systemPropertyVariables>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-invoker-plugin</artifactId>
                    <version>${maven-invoker-plugin.version}</version>
                    <configuration>
                        <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                        <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
                        <mergeUserSettings>false</mergeUserSettings>
                        <properties>
                            <maven.compiler.release>11</maven.compiler.release>
                        </properties>
                        <goals>
                            <goal>verify -e</goal>
                        </goals>
                        <streamLogs>true</streamLogs>
                        <postBuildHookScript>verify</postBuildHookScript>
                        <writeJunitReport>true</writeJunitReport>
                    </configuration>
                    <executions>
                        <execution>
                            <id>integration-test</id>
                            <goals>
                                <goal>install</goal>
                                <goal>run</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.10</version>
                </plugin>
                <plugin>
                    <groupId>org.projectlombok</groupId>
                    <artifactId>lombok-maven-plugin</artifactId>
                    <version>${lombok-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>delombok</goal>
                            </goals>
                            <configuration>
                                <skip>true</skip>
                                <addOutputDirectory>false</addOutputDirectory>
                                <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
                            </configuration>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${org.projectlombok.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.cyclonedx</groupId>
                <artifactId>cyclonedx-maven-plugin</artifactId>
                <version>${cyclonedx-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>makeAggregateBom</goal>
                        </goals>
                        <configuration>
                            <includeCompileScope>true</includeCompileScope>
                            <includeProvidedScope>false</includeProvidedScope>
                            <includeRuntimeScope>true</includeRuntimeScope>
                            <includeSystemScope>true</includeSystemScope>
                            <includeTestScope>false</includeTestScope>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>com.buschmais.jqassistant</groupId>
                <artifactId>jqassistant-maven-plugin</artifactId>
                <version>${com.buschmais.jqassistant.version}</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>IT</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>${maven-surefire-plugin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>it-store-remote</id>
            <properties>
                <it.jqassistant.store.uri>neo4j://localhost:7687</it.jqassistant.store.uri>
            </properties>
        </profile>
        <profile>
            <id>it-store-file</id>
            <properties>
                <it.jqassistant.store.uri>file:${project.build.directory}/jqassistant/test-store</it.jqassistant.store.uri>
            </properties>
        </profile>
        <profile>
            <id>sonar</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <sonar.host.url>https://sonarcloud.io</sonar.host.url>
                <sonar.organization>jqassistant-plugin</sonar.organization>
                <sonar.moduleKey>${project.artifactId}</sonar.moduleKey>
                <sonar.login>${env.SONARCLOUD_LOGIN}</sonar.login>
                <sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonarsource.scanner.maven</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sonar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <configuration>
                            <!-- Prevent `gpg` from using pinentry programs -->
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus-staging-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>sonatype-nexus-staging</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <modules>
        <module>rules</module>
        <module>parent</module>
    </modules>

</project>
