<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright The WildFly Authors
  ~ SPDX-License-Identifier: Apache-2.0
  -->
<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>

    <parent>
        <groupId>org.jboss</groupId>
        <artifactId>jboss-parent</artifactId>
        <version>49</version>
    </parent>

    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-zip-plugin</artifactId>
    <!--
    Maintain separation between the artifact id and the version to help prevent
    merge conflicts between commits changing the GA and those changing the V.
    -->
    <version>0.9.0</version>
    <packaging>maven-plugin</packaging>

    <name>WildFly Plugins -- Zip Attachment Plugin</name>
    <description>Maven plugin/ Plexus components that enable use of 'zip' as a Maven packaging type.</description>

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

    <scm>
        <connection>scm:git:${wildfly.repo.scm.connection}</connection>
        <developerConnection>scm:git:${wildfly.repo.scm.connection}</developerConnection>
        <url>${wildfly.repo.scm.url}</url>
        <tag>HEAD</tag>
    </scm>

    <properties>
        <!-- Require Java 11 -->
        <required.java.build.version>[11,)</required.java.build.version>
        <required.java.deploy.version>[11,12)</required.java.deploy.version>
        <maven.compiler.target>11</maven.compiler.target>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.release>11</maven.compiler.release>

        <wildfly.repo.scm.connection>git@github.com:bstansberry/plexus-zip-components.git</wildfly.repo.scm.connection>
        <wildfly.repo.scm.url>https://github.com/bstansberry/plexus-zip-components</wildfly.repo.scm.url>

        <nexus.url>https://origin-repository-nx3.stage.jboss.org/nexus3</nexus.url>
        <nexus.repo>wildfly</nexus.repo>

        <version.adoc-maven-plugin-descriptor>1.0.0.Alpha3</version.adoc-maven-plugin-descriptor>
        <version.org.apache.maven>3.8.4</version.org.apache.maven>
        <version.org.apache.maven.plugin-tools>3.6.4</version.org.apache.maven.plugin-tools>
        <version.org.sonatype.plugins.nxrm3-maven-plugin>1.0.7</version.org.sonatype.plugins.nxrm3-maven-plugin>

        <!-- Checkstyle configuration -->
        <linkXRef>false</linkXRef>
        <version.org.wildfly.checkstyle-config>1.0.8.Final</version.org.wildfly.checkstyle-config>
        <version.org.jboss.staxmapper>1.5.0.Final</version.org.jboss.staxmapper>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>${version.org.apache.maven}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${version.org.apache.maven}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.maven</groupId>
                    <artifactId>maven-model</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.maven</groupId>
                    <artifactId>maven-artifact</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.sisu</groupId>
                    <artifactId>org.eclipse.sisu.plexus</artifactId>
                </exclusion>
            </exclusions>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>${version.org.apache.maven.plugin-tools}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.maven</groupId>
                    <artifactId>maven-artifact</artifactId>
                </exclusion>
            </exclusions>
        </dependency>


        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${version.org.apache.maven}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.maven</groupId>
                    <artifactId>maven-model</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.maven</groupId>
                    <artifactId>maven-model-builder</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.maven</groupId>
                    <artifactId>maven-repository-metadata</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-io</groupId>
                    <artifactId>commons-io</artifactId>
                </exclusion>
            </exclusions>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <!-- Checkstyle -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${version.checkstyle.plugin}</version>
                    <configuration>
                        <configLocation>wildfly-checkstyle/checkstyle.xml</configLocation>
                        <consoleOutput>true</consoleOutput>
                        <failsOnError>true</failsOnError>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <useFile />
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.wildfly.checkstyle</groupId>
                            <artifactId>wildfly-checkstyle-config</artifactId>
                            <version>${version.org.wildfly.checkstyle-config}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>check-style</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>checkstyle</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.wildfly.extras</groupId>
                    <artifactId>adoc-maven-plugin-descriptor</artifactId>
                    <version>${version.adoc-maven-plugin-descriptor}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <configuration>
                    <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
                    <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                    <goalPrefix>wfzip</goalPrefix>
                </configuration>
                <executions>
                    <execution>
                        <id>mojo-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.wildfly.extras</groupId>
                <artifactId>adoc-maven-plugin-descriptor</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>asciidoc-descriptor</goal>
                        </goals>
                        <phase>prepare-package</phase>
                    </execution>
                </executions>
            </plugin>

            <!-- We don't use the maven-deploy-plugin, so
                 set its default execution to phase 'none'.
                 See jboss-release profile for what we use. -->
            <!--<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-deploy</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>-->

            <!-- Require the minimum Java version -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${version.enforcer.plugin}</version>
                <executions>
                    <execution>
                        <id>require-java11-min</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>${required.java.build.version}</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jboss-release</id>
            <build>
                <plugins>

                    <!-- Require the correct java version for releasing -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>${version.enforcer.plugin}</version>
                        <executions>
                            <execution>
                                <id>require-java11-deploy</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <phase>validate</phase>
                                <configuration>
                                    <rules>
                                        <requireJavaVersion>
                                            <version>${required.java.deploy.version}</version>
                                        </requireJavaVersion>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <!--<plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nxrm3-maven-plugin</artifactId>
                        <version>${version.org.sonatype.plugins.nxrm3-maven-plugin}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>wildfly</serverId>
                            <nexusUrl>${nexus.url}</nexusUrl>
                            <repository>${nexus.repo}</repository>
                        </configuration>
                        <executions>
                            <execution>
                                <id>nexus-deploy</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>staging-deploy</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>-->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <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-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
