<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~
  ~ Copyright 2023 Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags.
  ~
  ~ 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">
    <parent>
        <groupId>org.jboss</groupId>
        <artifactId>jboss-parent</artifactId>
        <version>44</version>
        <relativePath/>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.wildfly.tools</groupId>
    <artifactId>wildfly-parent</artifactId>
    <version>1.0.4.Final</version>
    <packaging>pom</packaging>

    <url>https://wildfly.org</url>

    <scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false"
         child.scm.url.inherit.append.path="false">
        <connection>scm:git:git://github.com/wildfly/wildfly-dev-tools.git</connection>
        <developerConnection>scm:git:git@github.com:wildfly/wildfly-dev-tools.git</developerConnection>
        <url>https://github.com/wildfly/wildfly-dev-tools/tree/main/</url>
        <tag>HEAD</tag>
    </scm>

    <developers>
        <developer>
            <name>James R. Perkins</name>
            <email>jperkins@redhat.com</email>
            <organization>Red Hat, Inc.</organization>
            <organizationUrl>https://redhat.com</organizationUrl>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://repository.jboss.org/licenses/apache-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <!-- Configuration properties -->
        <skipFormatting>false</skipFormatting>
        <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>

        <version.formatter.maven.plugin>2.23.0</version.formatter.maven.plugin>
        <version.impsort.maven.plugin>1.9.0</version.impsort.maven.plugin>
        <version.nexus.staging.maven.plugin>1.6.13</version.nexus.staging.maven.plugin>
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${version.compiler.plugin}</version>
                    <configuration>
                        <release>${maven.compiler.release}</release>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.surefire.plugin}</version>
                    <configuration>
                        <redirectTestOutputToFile>${maven.test.redirectTestOutputToFile}</redirectTestOutputToFile>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>${version.formatter.maven.plugin}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.wildfly.tools</groupId>
                            <artifactId>ide-config</artifactId>
                            <version>1.0.4.Final</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <!-- store outside of target to speed up formatting when mvn clean is used -->
                        <cachedir>.cache</cachedir>
                        <configFile>eclipse-code-formatter.xml</configFile>
                        <configXmlFile>wildfly-xml.properties</configXmlFile>
                        <lineEnding>LF</lineEnding>
                        <includeResources>true</includeResources>
                        <removeTrailingWhitespace>true</removeTrailingWhitespace>
                        <skip>${skipFormatting}</skip>
                    </configuration>
                    <executions>
                        <execution>
                            <id>format</id>
                            <goals>
                                <goal>format</goal>
                            </goals>
                            <phase>process-sources</phase>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>net.revelc.code</groupId>
                    <artifactId>impsort-maven-plugin</artifactId>
                    <version>${version.impsort.maven.plugin}</version>
                    <configuration>
                        <!-- store outside of target to speed up formatting when mvn clean is used -->
                        <cachedir>.cache</cachedir>
                        <groups>java.,javax.,jakarta.,org.,com.</groups>
                        <staticGroups>*</staticGroups>
                        <skip>${skipFormatting}</skip>
                        <removeUnused>true</removeUnused>
                    </configuration>
                    <executions>
                        <execution>
                            <id>sort-imports</id>
                            <goals>
                                <goal>sort</goal>
                            </goals>
                            <phase>process-sources</phase>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>maven-central-release</id>
            <activation>
                <property>
                    <name>maven.central.release</name>
                </property>
            </activation>
            <distributionManagement>
                <snapshotRepository>
                    <id>${sonatype.server.id}</id>
                    <url>${repo.sonatype.url}/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>${sonatype.server.id}</id>
                    <url>${repo.sonatype.url}/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
            <properties>

                <!-- Maven Central properties -->
                <repo.sonatype.url>https://oss.sonatype.org</repo.sonatype.url>
                <sonatype.server.id>ossrh-wildfly</sonatype.server.id>
                <autoReleaseAfterClose>false</autoReleaseAfterClose>
            </properties>
            <build>
                <plugins>
                    <!-- Semantically ordered -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <configuration>
                            <rules>
                                <requireReleaseDeps>
                                    <message>No Snapshots Allowed!</message>
                                </requireReleaseDeps>
                            </rules>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <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>
                        <configuration>
                            <additionalOptions>
                                <additionalOption>-html5</additionalOption>
                            </additionalOptions>
                            <detectLinks>true</detectLinks>
                            <doclint>none</doclint>
                            <failOnError>false</failOnError>
                            <show>public</show>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</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>
                                    <!-- Prevent gpg from using pinentry programs -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${version.nexus.staging.maven.plugin}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>${sonatype.server.id}</serverId>
                            <nexusUrl>${repo.sonatype.url}</nexusUrl>
                            <autoReleaseAfterClose>${autoReleaseAfterClose}</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
