<?xml version="1.0" encoding="UTF-8"?>
<!--

     Copyright 2023 Red Hat

     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

         https://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>

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

    <groupId>org.jboss.elemento</groupId>
    <artifactId>elemento-parent</artifactId>
    <version>1.2.7</version>
    <packaging>pom</packaging>
    <name>Elemento Parent</name>
    <description>Builder API and other goodies for GWT Elemental</description>
    <url>http://github.com/hal/elemento</url>
    <inceptionYear>2023</inceptionYear>

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

    <organization>
        <name>Red Hat</name>
        <url>https://developers.redhat.com/</url>
    </organization>

    <developers>
        <developer>
            <name>Harald Pehl</name>
            <id>hpehl</id>
            <email>hpehl@redhat.com</email>
            <organization>Red Hat</organization>
            <timezone>+1</timezone>
        </developer>
        <developer>
            <name>Claudio Miranda</name>
            <id>claudio4j</id>
            <email>claudio@redhat.com</email>
            <organization>Red Hat</organization>
            <timezone>-3</timezone>
        </developer>
        <developer>
            <name>Ignacio Baca Moreno-Torres</name>
            <id>ibaca</id>
            <email>ignacio@bacamt.com</email>
            <timezone>+1</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git@github.com:hal/elemento.git</connection>
        <developerConnection>scm:git:git@github.com:hal/elemento.git</developerConnection>
        <url>https://github.com/hal/elemento</url>
        <tag>HEAD</tag>
    </scm>
    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/hal/elemento/issues</url>
    </issueManagement>
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <properties>
        <!-- Dependency versions -->
        <version.checkstyle.config>1.0.8.Final</version.checkstyle.config>
        <version.elemental2>1.2.1</version.elemental2>
        <version.gwt.event>1.0.0-RC1</version.gwt.event>
        <version.gwt.safehtml>1.0.0-RC1</version.gwt.safehtml>
        <version.junit>5.10.0</version.junit>

        <!-- Plugin versions -->
        <version.checkstyle.plugin>3.3.0</version.checkstyle.plugin>
        <version.enforcer.plugin>3.3.0</version.enforcer.plugin>
        <version.formatter.plugin>2.23.0</version.formatter.plugin>
        <version.impsort.plugin>1.9.0</version.impsort.plugin>
        <version.javadoc.plugin>3.6.0</version.javadoc.plugin>
        <version.keepachangelog>2.1.1</version.keepachangelog>
        <version.license.plugin>4.3</version.license.plugin>
        <version.nexus.staging.plugin>1.6.13</version.nexus.staging.plugin>

        <!-- Build related -->
        <encoding>UTF-8</encoding>
        <java.version>11</java.version>
        <javadoc.options/>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.min.version>3.2.5</maven.min.version>
        <project.build.sourceEncoding>${encoding}</project.build.sourceEncoding>
        <project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding>
    </properties>

    <modules>
        <module>bom</module>
        <module>build-config</module>
        <module>code-parent</module>
        <module>core</module>
        <module>mathml</module>
        <module>svg</module>
    </modules>

    <!-- No dependencies! Dependencies are managed in core-parent -->
    <dependencies/>

    <build>
        <pluginManagement>
            <plugins>
                <!-- Ordered by artifactID -->
                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>${version.formatter.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>net.revelc.code</groupId>
                    <artifactId>impsort-maven-plugin</artifactId>
                    <version>${version.impsort.plugin}</version>
                    <configuration>
                        <groups>java.,javax.,jakarta.,org.,io.,com.</groups>
                        <removeUnused>true</removeUnused>
                        <staticAfter>true</staticAfter>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>co.enear.maven.plugins</groupId>
                    <artifactId>keepachangelog-maven-plugin</artifactId>
                    <version>${version.keepachangelog}</version>
                </plugin>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${version.license.plugin}</version>
                    <configuration>
                        <aggregate>true</aggregate>
                        <strictCheck>true</strictCheck>
                        <useDefaultExcludes>true</useDefaultExcludes>
                        <licenseSets>
                            <licenseSet>
                                <header>build-config/src/main/resources/etc/license.txt</header>
                                <excludes>
                                    <exclude>LICENSE</exclude>
                                    <exclude>sed/*.sed</exclude>
                                    <exclude>**/*license*.txt</exclude>
                                    <exclude>src/demo/java/**</exclude>
                                </excludes>
                            </licenseSet>
                        </licenseSets>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <configuration>
                        <configLocation>wildfly-checkstyle/checkstyle.xml</configLocation>
                        <consoleOutput>true</consoleOutput>
                        <failsOnError>true</failsOnError>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <excludes>**/*$logger.java,**/*$bundle.java</excludes>
                        <useFile/>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.wildfly.checkstyle</groupId>
                            <artifactId>wildfly-checkstyle-config</artifactId>
                            <version>${version.checkstyle.config}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <configuration>
                        <rules>
                            <bannedRepositories>
                                <message>To build this project, don't use maven repositories over HTTP. Please use HTTPS
                                    in your settings.xml or run the build with property insecure.repositories=WARN
                                </message>
                                <level>ERROR</level>
                                <bannedRepositories>
                                    <bannedRepository>http://*</bannedRepository>
                                </bannedRepositories>
                                <bannedPluginRepositories>
                                    <bannedPluginRepository>http://*</bannedPluginRepository>
                                </bannedPluginRepositories>
                            </bannedRepositories>
                            <requireMavenVersion>
                                <message>To build this project Maven ${maven.min.version} (or greater) is required.
                                    Please install it.
                                </message>
                                <version>${maven.min.version}</version>
                            </requireMavenVersion>
                            <requireJavaVersion>
                                <message>To build this project JDK ${maven.compiler.source} (or greater) is required.
                                    Please install it.
                                </message>
                                <version>${maven.compiler.source}</version>
                            </requireJavaVersion>
                        </rules>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <!-- Ordered by artifactID -->
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>formatter-format</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>formatter-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>validate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.revelc.code</groupId>
                <artifactId>impsort-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>impsort-sort</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>sort</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>impsort-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>license-format</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>license-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <executions>
                    <execution>
                        <id>checkstyle-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforcer-enforce</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!--
            Profile to be used to generate Javadoc with code snippets. Requires Java 18!
            Used for building the online documentation published to GitHub pages
        -->
        <profile>
            <id>snippets</id>
            <properties>
                <javadoc.options>--snippet-path ${project.basedir}/src/demo/java</javadoc.options>
            </properties>
        </profile>
        <profile>
            <id>release</id>
            <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>
                        <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.plugin}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <repositories>
        <repository>
            <id>jboss-nexus</id>
            <url>https://repository.jboss.org/nexus/content/groups/public</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>
</project>
