<?xml version='1.0' encoding='UTF-8'?>
<!--
  ~ Copyright 2020 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.9.0</version>
        <relativePath />
    </parent>

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

    <name>Sign Maven Plugin</name>
    <description>
        Creates OpenPGP 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>
        <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>

    <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>v0.2.0</tag>
    </scm>

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

    <properties>
        <maven.version>3.6.0</maven.version>
        <slf4j-api.version>1.7.30</slf4j-api.version>
        <junit.version>5.7.0</junit.version>
        <project.build.outputTimestamp>2021-01-01T20:13:46Z</project.build.outputTimestamp>
    </properties>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-core</artifactId>
                <version>${maven.version}</version>
            </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>3.6.0</version>
            </dependency>

            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpg-jdk15on</artifactId>
                <version>1.68</version>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.16</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j-api.version}</version>
            </dependency>
            <dependency>
                <groupId>io.vavr</groupId>
                <artifactId>vavr</artifactId>
                <version>0.10.3</version>
            </dependency>

            <!-- testing -->
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.7.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.junit-pioneer</groupId>
                <artifactId>junit-pioneer</artifactId>
                <version>1.1.0</version>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>3.18.1</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-junit-jupiter</artifactId>
                <version>3.6.28</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${slf4j-api.version}</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.1.0</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-utils</artifactId>
                <version>3.3.0</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>
        </dependency>

        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpg-jdk15on</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>

        <!-- 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.junit-pioneer</groupId>
            <artifactId>junit-pioneer</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</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>
        <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-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <!-- https://junit-pioneer.org/docs/environment-variables -->
            <!-- https://github.com/junit-pioneer/junit-pioneer/issues/387 -->
            <id>jmv-9+</id>
            <activation>
                <jdk>[9,)</jdk>
            </activation>
            <properties>
                <argLine>--add-opens=java.base/java.util=ALL-UNNAMED</argLine>
            </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>4.0.0-alpha-1-SNAPSHOT</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</mavenHome>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
