<?xml version="1.0" encoding="UTF-8"?>
<!-- 
 Copyright 2019 - 2025 Acosix GmbH

 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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>de.acosix.maven</groupId>
    <artifactId>acosix-maven-parent</artifactId>
    <version>1.2.0</version>
    <packaging>pom</packaging>
    <name>Acosix Maven Parent</name>
    <description>Parent POM for all generic Acosix Maven projects</description>
    <url>https://github.com/Acosix/acosix-maven-parent</url>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git@github.com:Acosix/acosix-maven-parent.git</connection>
        <developerConnection>scm:git:git@github.com:Acosix/acosix-maven-parent.git</developerConnection>
        <url>git@github.com:Acosix/acosix-maven-parent.git</url>
    </scm>

    <developers>
        <developer>
            <id>AFaust</id>
            <name>Axel Faust</name>
            <email>axel.faust@acosix.de</email>
            <organization>Acosix GmbH</organization>
            <roles>
                <role>Founder</role>
                <role>Architect</role>
                <role>Developer</role>
            </roles>
            <properties>
                <twitter>twitter.com/ReluctantBird83</twitter>
            </properties>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Everything will be built for Java 8 by default -->
        <!-- Note: using 11 or newer fails during AMP assembly -->
        <!-- distinct exec (runtime via toolchain) + target (cross-compilation) -->
        <java.version>8</java.version>
        <java.version.exec>${java.version}</java.version.exec>
        <java.version.target>${java.version}</java.version.target>
        <toolchain.jdk.version>${java.version.exec}</toolchain.jdk.version>
        <maven.compiler.release>${java.version.target}</maven.compiler.release>
        <maven.compiler.source>${java.version.target}</maven.compiler.source>
        <maven.compiler.target>${java.version.target}</maven.compiler.target>

        <maven.enforcer.version>3.6.1</maven.enforcer.version>
        <maven.clean.version>3.5.0</maven.clean.version>
        <maven.resources.version>3.3.1</maven.resources.version>
        <maven.dependency.version>3.8.1</maven.dependency.version>
        <maven.compiler.version>3.14.0</maven.compiler.version>
        <maven.source.version>3.3.1</maven.source.version>
        <maven.javadoc.version>3.11.2</maven.javadoc.version>
        <maven.jar.version>3.4.2</maven.jar.version>
        <maven.toolchain.version>3.2.0</maven.toolchain.version>
        <maven.forbiddenapis.version>3.7</maven.forbiddenapis.version>
        <maven.forbiddenapis.targetVersion>${java.version.target}</maven.forbiddenapis.targetVersion>
        <maven.findbugs.version>3.0.5</maven.findbugs.version>
        <maven.surefire.version>3.5.3</maven.surefire.version>
        <maven.failsafe.version>3.5.3</maven.failsafe.version>
        <maven.install.version>3.1.4</maven.install.version>
        <maven.gpg.version>3.2.8</maven.gpg.version>
        <maven.deploy.version>3.1.4</maven.deploy.version>
        <maven.invoker.version>3.9.1</maven.invoker.version>

        <!-- we use the Sonatype plugin for deploy -->
        <maven.deploy.skip>true</maven.deploy.skip>

        <maven.sonatype.central.version>0.8.0</maven.sonatype.central.version>

        <maven.plugin.version>3.15.1</maven.plugin.version>
        <maven.plugin.api.version>3.9.11</maven.plugin.api.version>
        <maven.artifact.version>3.9.11</maven.artifact.version>
        <maven.core.version>${maven.plugin.version}.0</maven.core.version>
        <maven.compat.version>${maven.plugin.version}.0</maven.compat.version>
        <maven.model.version>${maven.plugin.version}.0</maven.model.version>
        
        <plexus.utils.version>4.0.2</plexus.utils.version>
    </properties>

    <repositories>
        <repository>
            <id>central-snapshots</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>central-snapshots</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <distributionManagement>
        <repository>
            <id>central</id>
            <url>https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
            <id>central</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <modules>
        <module>i18n-resources-plugin</module>
        <module>jshint-plugin</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-artifact</artifactId>
                <version>${maven.artifact.version}</version>
                <scope>provided</scope>
            </dependency>
    
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-plugin-api</artifactId>
                <version>${maven.plugin.api.version}</version>
                <scope>provided</scope>
            </dependency>
    
            <dependency>
                <groupId>org.apache.maven.plugin-tools</groupId>
                <artifactId>maven-plugin-annotations</artifactId>
                <version>${maven.plugin.version}</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-utils</artifactId>
                <version>${plexus.utils.version}</version>
                <scope>compile</scope>
            </dependency>

            <!-- Maven 3.9 stops exposing plexus-utils implicitly -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.13.2</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!-- TODO: Proper setup of reporting configuration -->

    <build>
        <pluginManagement>
            <plugins>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${maven.enforcer.version}</version>
                    <executions>
                        <execution>
                            <id>enforce-maven</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireMavenVersion>
                                        <version>[3.9,)</version>
                                    </requireMavenVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${maven.clean.version}</version>
                </plugin>

                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven.resources.version}</version>
                </plugin>

                <plugin>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven.dependency.version}</version>
                </plugin>

                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.version}</version>
                    <configuration>
                        <parameters>true</parameters>
                        <debuglevel>lines,vars,source</debuglevel>
                    </configuration>
                </plugin>

                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven.source.version}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                            <configuration>
                                <!-- strangely the default without the includes also contains JS/CSS files -->
                                <includes>
                                    <include>**/*.java</include>
                                </includes>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven.javadoc.version}</version>
                    <executions>
                        <execution>
                            <id>attach-javadoc</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven.jar.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>test-jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>${maven.plugin.version}</version>
                </plugin>

                <plugin>
                    <artifactId>maven-toolchains-plugin</artifactId>
                    <version>${maven.toolchain.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>toolchain</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <toolchains>
                            <jdk>
                                <version>${toolchain.jdk.version}</version>
                            </jdk>
                        </toolchains>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>de.thetaphi</groupId>
                    <artifactId>forbiddenapis</artifactId>
                    <version>${maven.forbiddenapis.version}</version>
                    <configuration>
                        <failOnUnsupportedJava>false</failOnUnsupportedJava>
                        <failOnMissingClasses>false</failOnMissingClasses>
                        <failOnUnresolvableSignatures>false</failOnUnresolvableSignatures>
                        <targetVersion>${maven.forbiddenapis.targetVersion}</targetVersion>
                        <bundledSignatures>
                            <bundledSignature>jdk-unsafe</bundledSignature>
                            <bundledSignature>jdk-deprecated</bundledSignature>
                            <bundledSignature>jdk-internal</bundledSignature>
                            <bundledSignature>jdk-system-out</bundledSignature>
                            <bundledSignature>jdk-non-portable</bundledSignature>
                            <bundledSignature>jdk-reflection</bundledSignature>
                        </bundledSignatures>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.version}</version>
                </plugin>

                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven.failsafe.version}</version>
                </plugin>

                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${maven.install.version}</version>
                </plugin>

                <plugin>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven.gpg.version}</version>
                    <configuration>
                        <useAgent>false</useAgent>
                        <keyname>${gpg.keyname}</keyname>
                        <passphraseServerId>${gpg.keyname}</passphraseServerId>
                    </configuration>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven.deploy.version}</version>
                </plugin>

                <plugin>
                    <artifactId>maven-invoker-plugin</artifactId>
                    <version>${maven.invoker.version}</version>
                    <configuration>
                        <settingsFile>src/test/pom/settings.xml</settingsFile>
                        <projectsDirectory>src/test/pom</projectsDirectory>
                        <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
                        <pomIncludes>
                            <pomInclude>**/pom.xml</pomInclude>
                        </pomIncludes>
                        <postBuildHookScript>verify</postBuildHookScript>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>install</goal>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>${maven.sonatype.central.version}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <deploymentName>central.sonatype.com</deploymentName>
                        <autoPublish>true</autoPublish>
                        <waitUntil>published</waitUntil>
                    </configuration>
                </plugin>

                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
                <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-toolchains-plugin</artifactId>
                                        <versionRange>[${maven.toolchain.version},)</versionRange>
                                        <goals>
                                            <goal>toolchain</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-plugin-plugin</artifactId>
                                        <versionRange>[${maven.plugin.version},)</versionRange>
                                        <goals>
                                            <goal>descriptor</goal>
                                            <goal>helpmojo</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>

            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <id>Toolchains</id>

            <activation>
                <file>
                    <exists>${user.home}/.m2/toolchains.xml</exists>
                </file>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-toolchains-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>java-8-forbidden-api</id>
            
            <activation>
                <property>
                    <name>java.version.target</name>
                    <value>8</value>
                </property>
            </activation>
            
            <properties>
                <maven.forbiddenapis.targetVersion>1.${java.version.target}</maven.forbiddenapis.targetVersion>
            </properties>
        </profile>

        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>