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

     Copyright 2022 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

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

    <groupId>org.jboss.hal</groupId>
    <artifactId>hal-parent</artifactId>
    <version>3.7.9.Final</version>
    <packaging>pom</packaging>
    <name>HAL :: Parent</name>
    <description>WildFly / EAP management console</description>
    <url>https://hal.github.io/</url>
    <inceptionYear>2022</inceptionYear>

    <licenses>
        <license>
            <name>Apache License, Version 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>
            <roles>
                <role>Lead</role>
            </roles>
        </developer>
        <developer>
            <name>Claudio Miranda</name>
            <id>claudio4j</id>
            <email>claudio@redhat.com</email>
            <organization>Red Hat</organization>
            <timezone>-3</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:${repo.scm.connection}</connection>
        <developerConnection>scm:git:${repo.scm.connection}</developerConnection>
        <url>${repo.scm.url}</url>
        <tag>HEAD</tag>
    </scm>
    <issueManagement>
        <system>jira</system>
        <url>https://issues.jboss.org/browse/HAL</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.auto.service>1.1.1</version.auto.service>
        <version.apt.tools>0.0.3</version.apt.tools>
        <version.compile.testing>0.21.0</version.compile.testing>
        <version.elemental>1.2.0</version.elemental>
        <version.elemento>1.0.14-gwtcom</version.elemento>
        <version.gin>2.1.2</version.gin>
        <version.guava>31.1-jre</version.guava>
        <version.gwt>2.11.0</version.gwt>
        <version.gwtp>1.6</version.gwtp>
        <version.jaxen>1.2.0</version.jaxen>
        <version.jboss.dmr>1.7.0.Final</version.jboss.dmr>
        <version.jsinterop>1.0.1</version.jsinterop>
        <version.jdom>2.0.2</version.jdom>
        <version.junit>4.13.2</version.junit>
        <version.mockito>5.15.2</version.mockito>
        <version.node>v20.17.0</version.node>
        <version.npm>10.8.2</version.npm>
        <version.slf4j>2.0.3</version.slf4j>
        <version.slf4j.gwt>1.7.7.1</version.slf4j.gwt>
        <version.validation>1.0.0.GA</version.validation>

        <!-- Plugin versions -->
        <version.build.helper.plugin>3.6.0</version.build.helper.plugin>
        <version.checkstyle.plugin>3.3.0</version.checkstyle.plugin>
        <version.degraph.plugin>4.0.3</version.degraph.plugin>
        <version.enforcer.plugin>3.3.0</version.enforcer.plugin>
        <version.formatter.plugin>2.23.0</version.formatter.plugin>
        <version.frontend.plugin>1.15.1</version.frontend.plugin>
        <version.gwt.plugin>1.1.0</version.gwt.plugin>
        <version.impsort.plugin>1.9.0</version.impsort.plugin>
        <version.keepachangelog>2.1.1</version.keepachangelog>
        <version.license.plugin>4.6</version.license.plugin>
        <version.nexus.staging.plugin>1.7.0</version.nexus.staging.plugin>

        <!-- Quarkus -->
        <!-- 3.2.0 has LTS with support for Java 11 -->
        <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
        <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
        <quarkus.platform.version>3.2.0.Final</quarkus.platform.version>

        <!-- Repos & URLs -->
        <repo.scm.connection>git@github.com:hal/console.git</repo.scm.connection>
        <repo.scm.url>https://github.com/hal/console</repo.scm.url>

        <!-- Build related -->
        <encoding>UTF-8</encoding>
        <gwt.devmode.hostname>localhost</gwt.devmode.hostname>
        <gwt.draftCompile>true</gwt.draftCompile>
        <gwt.failOnError>true</gwt.failOnError>
        <gwt.logLevel>FINE</gwt.logLevel>
        <gwt.moduleShortname>hal</gwt.moduleShortname>
        <gwt.moduleTemplate>src/main/module.gwt.xml</gwt.moduleTemplate>
        <gwt.optimize>0</gwt.optimize>
        <gwt.style>DETAILED</gwt.style>
        <hal.version>${project.version}</hal.version>
        <java.version>11</java.version>
        <linkXRef>false</linkXRef>
        <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>
        <npm.script>dev</npm.script>
        <project.build.sourceEncoding>${encoding}</project.build.sourceEncoding>
        <project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding>
        <skip.gwt>false</skip.gwt>
        <theme.name>hal</theme.name>
    </properties>

    <modules>
        <module>app</module>
        <module>ballroom</module>
        <module>bom</module>
        <module>build-config</module>
        <module>code-parent</module>
        <module>config</module>
        <module>core</module>
        <module>db</module>
        <module>dmr</module>
        <module>flow</module>
        <module>gwt-parent</module>
        <module>js</module>
        <module>meta</module>
        <module>processors</module>
        <module>resources</module>
        <module>spi</module>
        <module>standalone</module>
        <module>testsuite</module>
        <module>themes</module>
    </modules>

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

    <build>
        <!--
            All plugins are declared and (partly) configured here.
            Some of them are redefined in core-parent
        -->
        <pluginManagement>
            <plugins>
                <!-- Ordered by artifactID -->
                <plugin>
                    <groupId>com.github.ferstl</groupId>
                    <artifactId>depgraph-maven-plugin</artifactId>
                    <version>${version.degraph.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${version.build.helper.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>${version.frontend.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>${version.formatter.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>net.ltgt.gwt.maven</groupId>
                    <artifactId>gwt-maven-plugin</artifactId>
                    <version>${version.gwt.plugin}</version>
                    <extensions>true</extensions>
                </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>
                        <staticGroups>java,*</staticGroups>
                        <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>
                        <mapping>
                            <Dockerfile>SCRIPT_STYLE</Dockerfile>
                            <Dockerfile-domain>SCRIPT_STYLE</Dockerfile-domain>
                            <Dockerfile-domain-development>SCRIPT_STYLE</Dockerfile-domain-development>
                            <Dockerfile-standalone>SCRIPT_STYLE</Dockerfile-standalone>
                            <Dockerfile-standalone-development>SCRIPT_STYLE</Dockerfile-standalone-development>
                            <parcelrc>DOUBLESLASH_STYLE</parcelrc>
                            <less>SLASHSTAR_STYLE</less>
                            <rng>XML_STYLE</rng>
                        </mapping>
                        <licenseSets>
                            <licenseSet>
                                <header>build-config/src/main/resources/etc/license.txt</header>
                                <excludes>
                                    <exclude>.sdkmanrc</exclude>
                                    <exclude>version.txt</exclude>
                                    <exclude>LICENSE</exclude>
                                    <exclude>CODEOWNERS</exclude>
                                    <exclude>README.md</exclude>
                                    <exclude>**/.parcel-cache/**</exclude>
                                    <exclude>**/banner.txt</exclude>
                                    <exclude>**/Dockerfile.*</exclude>
                                    <exclude>**/Constants*.properties</exclude>
                                    <exclude>**/Messages*.properties</exclude>
                                    <exclude>**/previews/**/*.html</exclude>
                                    <exclude>**/public/css/**</exclude>
                                    <exclude>**/public/js/**</exclude>
                                    <exclude>**/*license*.txt</exclude>
                                    <exclude>**/*.base64</exclude>
                                    <exclude>**/*.dmr</exclude>
                                </excludes>
                            </licenseSet>
                        </licenseSets>
                    </configuration>
                </plugin>
                <!-- Not used, but declared to dismiss warnings -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>2.0.0</version>
                </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>
                <plugin>
                    <groupId>io.quarkus.platform</groupId>
                    <artifactId>quarkus-maven-plugin</artifactId>
                    <version>${version.quarkus}</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <!-- Ordered by artifactID -->
            <plugin>
                <groupId>com.github.ferstl</groupId>
                <artifactId>depgraph-maven-plugin</artifactId>
                <configuration>
                    <createImage>true</createImage>
                    <customStyleConfiguration>degraph-style.json</customStyleConfiguration>
                    <includes>
                        <include>org.jboss.hal:hal-console</include>
                        <include>org.jboss.hal:hal-ballroom</include>
                        <include>org.jboss.hal:hal-config</include>
                        <include>org.jboss.hal:hal-core</include>
                        <include>org.jboss.hal:hal-db</include>
                        <include>org.jboss.hal:hal-dmr</include>
                        <include>org.jboss.hal:hal-flow</include>
                        <include>org.jboss.hal:hal-js</include>
                        <include>org.jboss.hal:hal-meta</include>
                        <include>org.jboss.hal:hal-resources</include>
                        <include>org.jboss.hal:hal-spi</include>
                        <include>com.google.elemental2:*</include>
                        <include>org.gwtproject:gwt-user</include>
                        <include>com.google.guava:guava</include>
                        <include>com.gwtplatform:gwtp-all</include>
                        <include>org.jboss.elemento:elemento-core</include>
                        <include>org.slf4j:slf4j-api</include>
                    </includes>
                    <mergeTypes>true</mergeTypes>
                    <scope>compile</scope>
                    <showGroupIds>true</showGroupIds>
                </configuration>
            </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-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforcer-enforce</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <executions>
                    <execution>
                        <id>hal-tests</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>test</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>quick-build</id>
            <activation>
                <property>
                    <name>quickly</name>
                </property>
            </activation>
            <properties>
                <checkstyle.skip>true</checkstyle.skip>
                <enforcer.skip>true</enforcer.skip>
                <formatter.skip>true</formatter.skip>
                <impsort.skip>true</impsort.skip>
                <license.skip>true</license.skip>
                <maven.javadoc.skip>true</maven.javadoc.skip>
                <skip.gwt>true</skip.gwt>
                <skipITs>true</skipITs>
                <skipTests>true</skipTests>
            </properties>
        </profile>
        <profile>
            <id>i18n</id>
            <properties>
                <gwt.moduleTemplate>src/main/module-i18n.gwt.xml</gwt.moduleTemplate>
            </properties>
        </profile>
        <profile>
            <id>native</id>
            <activation>
                <property>
                    <name>native</name>
                </property>
            </activation>
            <properties>
                <skipITs>true</skipITs>
                <quarkus.package.type>native</quarkus.package.type>
            </properties>
        </profile>
        <profile>
            <id>prod</id>
            <properties>
                <gwt.draftCompile>false</gwt.draftCompile>
                <!--
                    Do not optimize: It will wipe out code which actually must not be erased.
                    TODO Check if this is a bug in GWT or how much we can optimize until the code is removed.
                -->
                <gwt.logLevel>INFO</gwt.logLevel>
                <gwt.optimize>0</gwt.optimize>
                <gwt.style>OBFUSCATED</gwt.style>
                <npm.script>prod</npm.script>
            </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>
                        <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.plugin}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>skip-gwt</id>
            <properties>
                <skip.gwt>true</skip.gwt>
            </properties>
        </profile>
        <profile>
            <id>theme-eap</id>
            <properties>
                <theme.name>eap</theme.name>
            </properties>
        </profile>
        <profile>
            <id>theme-hal</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <theme.name>hal</theme.name>
            </properties>
        </profile>
        <profile>
            <id>theme-wildfly</id>
            <properties>
                <theme.name>wildfly</theme.name>
            </properties>
        </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>
