<?xml version='1.0' encoding='UTF-8'?>
<!--
  ~ Copyright 2020-2021 Slawomir Jaranowski
  ~
  ~ 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.simplify4u</groupId>
        <artifactId>parent</artifactId>
        <version>2.20.1</version>
        <relativePath />
    </parent>

    <groupId>org.simplify4u.plugins</groupId>
    <artifactId>sign-maven-plugin</artifactId>
    <version>1.1.0</version>
    <packaging>maven-plugin</packaging>

    <name>Sign Maven Plugin</name>
    <description>
        Creates Open PGP / GPG signatures for all of the project's artifacts
        without any external software
    </description>
    <url>https://www.simplify4u.org/sign-maven-plugin</url>
    <inceptionYear>2020</inceptionYear>

    <organization>
        <name>Simplify4U</name>
        <url>https://www.simplify4u.org</url>
    </organization>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <!-- Join a team if you want to support, maintain project -->
        <developer>
            <id>sjaranowski</id>
            <name>Slawomir Jaranowski</name>
            <email>s.jaranowski@gmail.com</email>
            <url>https://github.com/slawekjaranowski</url>
            <timezone>Europe/Warsaw</timezone>
        </developer>

        <developer>
            <id>mkarg</id>
            <name>Markus Karg</name>
            <email>markus@headcrashing.eu</email>
            <url>https://github.com/mkarg</url>
            <timezone>Europe/Berlin</timezone>
        </developer>
    </developers>

    <contributors>
        <!-- Add yourself to list after contributions - if wish -->
    </contributors>

    <prerequisites>
        <maven>${maven.version}</maven>
    </prerequisites>

    <scm>
        <connection>scm:git:git@github.com:s4u/sign-maven-plugin.git</connection>
        <developerConnection>${project.scm.connection}</developerConnection>
        <url>https://github.com/s4u/sign-maven-plugin</url>
        <tag>v1.1.0</tag>
    </scm>

    <distributionManagement>
        <site>
            <id>github</id>
            <url>${project.scm.connection}</url>
        </site>
    </distributionManagement>

    <properties>

        <maven.version>3.6.0</maven.version>
        <maven4.version>4.0.0-alpha-12</maven4.version>
        <mockito.version>4.11.0</mockito.version>
        <pgpverify-maven-plugin.version>1.17.0</pgpverify-maven-plugin.version>

        <project.build.outputTimestamp>2024-02-20T20:45:46Z</project.build.outputTimestamp>

        <!-- default value is needed when jacoco is not executed -->
        <argLine />
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- maven core -->
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-core</artifactId>
                <version>${maven.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.sonatype.plexus</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-plugin-api</artifactId>
                <version>${maven.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.plugin-tools</groupId>
                <artifactId>maven-plugin-annotations</artifactId>
                <version>${maven-plugin-plugin.version}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-sec-dispatcher</artifactId>
                <version>2.0</version>
            </dependency>
            <dependency>
                <groupId>javax.inject</groupId>
                <artifactId>javax.inject</artifactId>
                <version>1</version>
            </dependency>

            <!-- external library -->
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpg-jdk18on</artifactId>
                <version>1.77</version>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.30</version>
            </dependency>
            <!-- Maven 3.x only support slf4j 1.7.x-->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.36</version>
            </dependency>
            <dependency>
                <groupId>io.vavr</groupId>
                <artifactId>vavr</artifactId>
                <version>0.10.4</version>
            </dependency>

            <!-- testing -->
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>3.25.3</version>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.10.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-junit-jupiter</artifactId>
                <version>${mockito.version}</version>
            </dependency>
            <dependency>
                <groupId>org.simplify4u</groupId>
                <artifactId>slf4j-mock</artifactId>
                <version>2.3.0</version>
            </dependency>

            <!-- dependency coverage -->
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-artifact</artifactId>
                <version>${maven.version}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-component-annotations</artifactId>
                <version>2.2.0</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-utils</artifactId>
                <version>4.0.0</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-xml</artifactId>
                <version>3.0.0</version>
            </dependency>
            <dependency>
                <!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=552642 -->
                <groupId>org.eclipse.sisu</groupId>
                <artifactId>org.eclipse.sisu.inject</artifactId>
                <version>0.3.5</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-sec-dispatcher</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpg-jdk18on</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.vavr</groupId>
            <artifactId>vavr</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-xml</artifactId>
        </dependency>

        <!-- testing -->
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.simplify4u</groupId>
            <artifactId>slf4j-mock</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>apache-snapshot</id>
            <url>https://repository.apache.org/content/repositories/snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.simplify4u.plugins</groupId>
                    <artifactId>pgpverify-maven-plugin</artifactId>
                    <version>${pgpverify-maven-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generated-help-mojo</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-report-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>ci-system</id>
            <activation>
                <property>
                    <name>env.CI</name>
                </property>
            </activation>
            <properties>
                <invoker.streamLogsOnFailures>true</invoker.streamLogsOnFailures>
            </properties>
        </profile>

        <profile>
            <!-- when maven.test.skip is set we skip integration tests -->
            <id>integration-testing</id>
            <activation>
                <property>
                    <name>maven.test.skip</name>
                    <value>!true</value>
                </property>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludedEnvironmentVariables>
                                <!-- exclude configuration variable from test environment -->
                                <excludedVariable>SIGN_KEY</excludedVariable>
                                <excludedVariable>SIGN_KEY_ID</excludedVariable>
                                <excludedVariable>SIGN_KEY_PASS</excludedVariable>
                            </excludedEnvironmentVariables>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-maven4</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <!--
                                        https://repository.apache.org/content/groups/snapshots/org/apache/maven/maven/
                                        -->
                                        <artifactItem>
                                            <groupId>org.apache.maven</groupId>
                                            <artifactId>apache-maven</artifactId>
                                            <version>${maven4.version}</version>
                                            <type>zip</type>
                                            <classifier>bin</classifier>
                                        </artifactItem>
                                    </artifactItems>
                                    <outputDirectory>${project.build.directory}/maven4</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>it-tests-public-key</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/keys-cache</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>src/test/resources/public-keys</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <configuration>
                            <pomIncludes>
                                <pomInclude>*/pom-test.xml</pomInclude>
                            </pomIncludes>
                            <settingsFile>src/it/settings.xml</settingsFile>
                            <showErrors>true</showErrors>
                            <showVersion>true</showVersion>
                            <environmentVariables>
                                <SIGN_KEY />
                                <SIGN_KEY_ID />
                                <SIGN_KEY_PASS />
                            </environmentVariables>
                        </configuration>
                        <executions>
                            <execution>
                                <id>invoker-tests-maven3</id>
                                <goals>
                                    <goal>install</goal>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                                <configuration>
                                    <cloneProjectsTo>${project.build.directory}/it3</cloneProjectsTo>
                                    <localRepositoryPath>${project.build.directory}/it3-repo</localRepositoryPath>
                                    <reportsDirectory>${project.build.directory}/invoker-reports3</reportsDirectory>
                                </configuration>
                            </execution>
                            <execution>
                                <id>invoker-tests-maven4</id>
                                <goals>
                                    <goal>install</goal>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                                <configuration>
                                    <cloneProjectsTo>${project.build.directory}/it4</cloneProjectsTo>
                                    <localRepositoryPath>${project.build.directory}/it4-repo</localRepositoryPath>
                                    <reportsDirectory>${project.build.directory}/invoker-reports4</reportsDirectory>
                                    <mavenHome>${project.build.directory}/maven4/apache-maven-${maven4.version}</mavenHome>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
