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

    Copyright © 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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>io.gravitee</groupId>
    <artifactId>gravitee-parent</artifactId>
    <version>22.6.0</version>
    <packaging>pom</packaging>

    <name>Gravitee.io APIM - Parent POM</name>

    <description>The Gravitee.IO Parent POM provides common settings for all Gravitee components.</description>
    <url>https://github.com/gravitee-io</url>
    <inceptionYear>2015</inceptionYear>

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

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/gravitee-io/issues/issues</url>
    </issueManagement>

    <scm>
        <url>https://github.com/gravitee-io/parent</url>
        <connection>scm:git:git://github.com/gravitee-io/parent.git</connection>
        <developerConnection>scm:git:git@github.com:gravitee-io/parent.git</developerConnection>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-staging</id>
            <url>https://central.sonatype.com</url>
        </repository>
    </distributionManagement>

    <organization>
        <name>Gravitee.IO</name>
        <url>https://gravitee.io</url>
    </organization>

    <developers>
        <developer>
            <email>azize@graviteesource.com</email>
            <name>Azize ELAMRANI</name>
            <url>https://github.com/aelamrani</url>
            <id>aelamrani</id>
        </developer>
        <developer>
            <email>david@graviteesource.com</email>
            <name>David BRASSELY</name>
            <url>https://github.com/brasseld</url>
            <id>brasseld</id>
        </developer>
        <developer>
            <email>nicolas@graviteesource.com</email>
            <name>Nicolas GERAUD</name>
            <url>https://github.com/NicolasGeraud</url>
            <id>NicolasGeraud</id>
        </developer>
        <developer>
            <email>titouan@graviteesource.com</email>
            <name>Titouan COMPIEGNE</name>
            <url>https://github.com/tcompiegne</url>
            <id>tcompiegne</id>
        </developer>
    </developers>

    <properties>
        <surefireArgLine></surefireArgLine>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!-- Because of this issues.apache.org/jira/projects/MASSEMBLY/issues/MASSEMBLY-1031 we need to force the version to 3.6.0 -->
        <maven-assembly-plugin.version>3.6.0</maven-assembly-plugin.version>
        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>
        <maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
        <maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
        <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
        <os-maven-plugin.version>1.7.1</os-maven-plugin.version>
        <license-maven-plugin.version>4.6</license-maven-plugin.version>
        <prettier-maven-plugin.version>0.22</prettier-maven-plugin.version>
        <prettier-maven-plugin.prettierJavaVersion>2.7.5</prettier-maven-plugin.prettierJavaVersion>
        <central-publishing-maven-plugin.version>0.8.0</central-publishing-maven-plugin.version>
        <skip.validation>false</skip.validation>
        <versions-maven-plugin.version>2.18.0</versions-maven-plugin.version>
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>${maven-assembly-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>${versions-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${maven-enforcer-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>enforce-no-log4j</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <bannedDependencies>
                                        <message>No log4j implementations allowed</message>
                                        <excludes>
                                            <exclude>org.apache.logging.log4j</exclude>
                                        </excludes>
                                        <includes>
                                            <!-- log4j-api can be used by some dependencies instead of slf4j-api -->
                                            <!-- in order to work with logback, we need to allow it and also the bridge log4j to slf4j -->
                                            <include>org.apache.logging.log4j:log4j-api</include>
                                            <include>org.apache.logging.log4j:log4j-to-slf4j</include>
                                        </includes>
                                    </bannedDependencies>
                                </rules>
                            </configuration>
                        </execution>
                        <execution>
                            <id>enforce-no-snapshots</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <!-- will be activated only in release profiles-->
                                <skip>true</skip>
                                <rules>
                                    <requireReleaseDeps>
                                        <message>No Snapshots Allowed!</message>
                                        <excludes>
                                            <!-- Workaround to break cyclic dependencies in APIM between plugins and core APIM -->
                                            <exclude>io.gravitee.*:*:*:*:test</exclude>
                                            <exclude>io.gravitee.apim.*:*:*:*:provided</exclude>
                                        </excludes>
                                    </requireReleaseDeps>
                                    <requireReleaseVersion>
                                        <message>No Snapshots Allowed!</message>
                                    </requireReleaseVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven-resources-plugin.version}</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <source>17</source>
                        <target>17</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <argLine>${surefireArgLine}</argLine>
                        <includes>
                            <!-- Default inclusions -->
                            <include>**/Test*.java</include>
                            <include>**/*Test.java</include>
                            <include>**/*TestCase.java</include>

                            <!-- Test suite inclusion -->
                            <include>**/*Suite.java</include>
                        </includes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${license-maven-plugin.version}</version>
                    <configuration>
                        <properties>
                            <owner>The Gravitee team</owner>
                            <email>http://gravitee.io</email>
                        </properties>
                        <licenseSets>
                            <licenseSet>
                                <header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
                                <excludes>
                                    <exclude>LICENSE.txt</exclude>
                                    <exclude>**/README</exclude>
                                    <exclude>src/main/packaging/**</exclude>
                                    <exclude>src/test/resources/**</exclude>
                                    <exclude>src/main/resources/**</exclude>
                                    <exclude>src/main/webapp/**</exclude>
                                    <exclude>node_modules/**</exclude>
                                    <exclude>dist/**</exclude>
                                    <exclude>.tmp/**</exclude>
                                    <exclude>.*</exclude>
                                    <exclude>.*/**</exclude>
                                    <exclude>**/*.adoc</exclude>
                                </excludes>
                            </licenseSet>
                        </licenseSets>
                        <skip>${skip.validation}</skip>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>${central-publishing-maven-plugin.version}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <publishingServerId>sonatype-nexus-staging</publishingServerId>
                        <autoPublish>true</autoPublish>
                        <deploymentName>${project.artifactId}:${project.version}</deploymentName>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                            <configuration>
                                <gpgArguments>
                                    <arg>--pinentry-mode</arg>
                                    <arg>loopback</arg>
                                </gpgArguments>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                    <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>
                    <version>${maven-javadoc-plugin.version}</version>
                    <configuration>
                        <doclint>none</doclint>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>com.hubspot.maven.plugins</groupId>
                    <artifactId>prettier-maven-plugin</artifactId>
                    <version>${prettier-maven-plugin.version}</version>
                    <configuration>
                        <prettierJavaVersion>${prettier-maven-plugin.prettierJavaVersion}</prettierJavaVersion>
                        <skip>${skip.validation}</skip>
                        <inputGlobs>
                            <inputGlob>src/main/java/**/*.java</inputGlob>
                            <inputGlob>src/test/java/**/*.java</inputGlob>
                            <inputGlob>**/*.json</inputGlob>
                            <inputGlob>**/*.yaml</inputGlob>
                            <inputGlob>**/*.yml</inputGlob>
                        </inputGlobs>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>validate</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.hubspot.maven.plugins</groupId>
                <artifactId>prettier-maven-plugin</artifactId>
            </plugin>
        </plugins>

        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>${os-maven-plugin.version}</version>
            </extension>
        </extensions>
    </build>

    <profiles>
        <profile>
            <!-- Profile used to release open source modules -->
            <id>gravitee-release</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>enforce-no-snapshots</id>
                                <configuration>
                                    <skip>false</skip>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Profile used to release enterprise modules -->
            <id>gio-release</id>

            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>enforce-no-snapshots</id>
                                <configuration>
                                    <skip>false</skip>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <repositories>
        <repository>
            <name>Central Portal Snapshots</name>
            <id>central-portal-snapshots</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
</project>
