<?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>53</version>
    </parent>

    <groupId>org.patternfly</groupId>
    <artifactId>patternfly-java-parent</artifactId>
    <version>0.9.2</version>
    <packaging>pom</packaging>
    <name>PatternFly Java Parent</name>
    <description>Java implementation of PatternFly</description>
    <url>https://patternfly-java.github.io</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>
            <id>hpehl</id>
            <name>Harald Pehl</name>
            <email>hpehl@redhat.com</email>
            <organization>Red Hat</organization>
            <timezone>+1</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git@github.com:${github.org}/${github.name}.git</connection>
        <developerConnection>scm:git:git@github.com:${github.org}/${github.name}.git</developerConnection>
        <url>https://github.com/${github.org}/${github.name}</url>
        <tag>HEAD</tag>
    </scm>
    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/${github.org}/${github.name}/issues</url>
    </issueManagement>
    <distributionManagement>
        <snapshotRepository>
            <id>central</id>
            <url>https://central.sonatype.com/repository/maven-snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <!-- Dependency versions -->
        <version.checkstyle.config>1.0.8.Final</version.checkstyle.config>
        <version.corepack>v0.34.6</version.corepack>
        <version.elemental2>1.3.2</version.elemental2> <!-- Only used to link the API doc -->
        <version.elemento>2.5.2</version.elemento>
        <version.gwt>2.13.0</version.gwt>
        <version.gwt.event>1.0.0-RC1</version.gwt.event> <!-- Only used to link the API doc -->
        <version.gwt.safehtml>1.0.0-RC1</version.gwt.safehtml> <!-- Only used to link the API doc -->
        <version.junit>6.1.0</version.junit>
        <version.node>v25.8.1</version.node>
        <version.patternfly>6.5.2</version.patternfly>

        <!-- Plugin versions -->
        <version.central.publishing.plugin>0.10.0</version.central.publishing.plugin>
        <version.degraph.plugin>4.0.3</version.degraph.plugin>
        <version.editorconfig.plugin>0.2.0</version.editorconfig.plugin>
        <version.frontend.plugin>2.0.0</version.frontend.plugin>
        <version.gwt.plugin>1.3.0</version.gwt.plugin>
        <version.j2cl.plugin>0.23.7</version.j2cl.plugin>
        <version.impsort.plugin>1.13.0</version.impsort.plugin>
        <version.javadoc.plugin>3.12.0</version.javadoc.plugin>
        <version.keepachangelog>2.1.1</version.keepachangelog>
        <version.license.plugin>5.0.0</version.license.plugin>

        <!-- Build related -->
        <generated.file.excludes>**/IconSets.java,**/IconSpec*.java,**/showcase/Code.java,**/showcase/Documentation.java,**/showcase/ResourceBundle.java</generated.file.excludes>
        <encoding>UTF-8</encoding>
        <github.org>patternfly-java</github.org>
        <github.name>patternfly-java</github.name>
        <java.version>21</java.version>
        <maven.compiler.release>${java.version}</maven.compiler.release>
        <maven.min.version>3.9.9</maven.min.version>
        <project.build.sourceEncoding>${encoding}</project.build.sourceEncoding>
        <project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding>
    </properties>

    <modules>
        <module>build-config</module>
        <module>charts</module>
        <module>code-parent</module>
        <module>components</module>
        <module>core</module>
        <module>extensions/codeeditor</module>
        <module>extensions/finder</module>
        <module>gwt</module>
        <module>icons</module>
        <module>j2cl</module>
        <module>layouts</module>
        <module>tokens</module>
    </modules>

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

    <build>
        <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.ec4j.maven</groupId>
                    <artifactId>editorconfig-maven-plugin</artifactId>
                    <version>${version.editorconfig.plugin}</version>
                    <configuration>
                        <excludes>
                            <exclude>**/.parcel-cache/**</exclude>
                            <exclude>**/node/**</exclude>
                            <exclude>**/node_modules/**</exclude>
                            <exclude>docs/**</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>${version.frontend.plugin}</version>
                    <configuration>
                        <nodeVersion>${version.node}</nodeVersion>
                        <corepackVersion>${version.corepack}</corepackVersion>
                    </configuration>
                </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>
                        <removeUnused>true</removeUnused>
                        <staticAfter>true</staticAfter>
                        <excludes>${generated.file.excludes}</excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.kie.j2cl.tools</groupId>
                    <artifactId>j2cl-maven-plugin</artifactId>
                    <version>${version.j2cl.plugin}</version>
                    <configuration>
                        <webappDirectory>${project.build.directory}/showcase</webappDirectory>
                        <workerThreadCount>4</workerThreadCount>
                    </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>
                            <parcelrc>DOUBLESLASH_STYLE</parcelrc>
                            <mjs>SLASHSTAR_STYLE</mjs>
                        </mapping>
                        <licenseSets>
                            <licenseSet>
                                <header>build-config/src/main/resources/etc/license.txt</header>
                                <excludes>
                                    <exclude>**/*.ftl</exclude>
                                    <exclude>**/*.js.map</exclude>
                                    <exclude>**/*.mp4</exclude>
                                    <exclude>**/*.pem</exclude>
                                    <exclude>**/*.png</exclude>
                                    <exclude>**/*license*.txt</exclude>
                                    <exclude>**/.dockerignore</exclude>
                                    <exclude>**/.npmignore</exclude>
                                    <exclude>**/.parcel-cache/**</exclude>
                                    <exclude>**/Dockerfile*</exclude>
                                    <exclude>**/banner.txt</exclude>
                                    <exclude>**/cert.pem</exclude>
                                    <exclude>**/js-cookie.js</exclude>
                                    <exclude>**/key.pem</exclude>
                                    <exclude>**/node/**</exclude>
                                    <exclude>**/node_modules/**</exclude>
                                    <exclude>**/package-lock.json</exclude>
                                    <exclude>**/pnpm-lock.yaml</exclude>
                                    <exclude>**/src/demo/java/**</exclude>
                                    <exclude>**/src/main/java/org/patternfly/core/Version.java</exclude>
                                    <!-- Generated files — also excluded via ${generated.file.excludes} in impsort and checkstyle -->
                                    <exclude>**/src/main/java/org/patternfly/icon/IconSets.java</exclude>
                                    <exclude>**/src/main/java/org/patternfly/icon/IconSpec*.java</exclude>
                                    <exclude>**/src/main/java/org/patternfly/popper/popper.js</exclude>
                                    <exclude>**/src/main/java/org/patternfly/showcase/Code.java</exclude>
                                    <exclude>**/src/main/java/org/patternfly/showcase/Documentation.java</exclude>
                                    <exclude>**/src/main/java/org/patternfly/showcase/ResourceBundle.java</exclude>
                                    <exclude>**/src/main/java/org/patternfly/token/Token.java</exclude>
                                    <exclude>**/src/main/resources/META-INF/externs/**</exclude>
                                    <exclude>LICENSE</exclude>
                                    <exclude>README.md</exclude>
                                    <exclude>degraph-style.json</exclude>
                                    <exclude>dependency-graph.dot</exclude>
                                    <exclude>docs/**</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,${generated.file.excludes}</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>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <!-- Ordered by artifactID -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-demos</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.basedir}/src/demo/java</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.ferstl</groupId>
                <artifactId>depgraph-maven-plugin</artifactId>
                <configuration>
                    <classpathScope>compile</classpathScope>
                    <createImage>true</createImage>
                    <customStyleConfiguration>degraph-style.json</customStyleConfiguration>
                    <includes>
                        <include>${project.groupId}:patternfly-java-charts</include>
                        <include>${project.groupId}:patternfly-java-codeeditor</include>
                        <include>${project.groupId}:patternfly-java-components</include>
                        <include>${project.groupId}:patternfly-java-core</include>
                        <include>${project.groupId}:patternfly-java-finder</include>
                        <include>${project.groupId}:patternfly-java-gwt</include>
                        <include>${project.groupId}:patternfly-java-icons</include>
                        <include>${project.groupId}:patternfly-java-j2cl</include>
                        <include>${project.groupId}:patternfly-java-layouts</include>
                        <include>${project.groupId}:patternfly-java-tokens</include>
                        <include>org.jboss.elemento:elemento-*</include>
                        <include>com.google.elemental2:*</include>
                        <include>org.gwtproject:gwt-user</include>
                    </includes>
                    <mergeTypes>true</mergeTypes>
                    <mergeClassifiers>true</mergeClassifiers>
                    <outputDirectory>${project.basedir}</outputDirectory>
                    <showDuplicates>false</showDuplicates>
                    <showGroupIds>true</showGroupIds>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <additionalOptions>--snippet-path=${project.basedir}/src/demo/java</additionalOptions>
                    <debug>true</debug>
                    <detectLinks>true</detectLinks>
                    <doclint>none</doclint>
                    <sourceFileExcludes>
                        <exclude>**/*Demo.java</exclude>
                    </sourceFileExcludes>
                    <failOnError>false</failOnError>
                    <links>
                        <link>https://hal.github.io/elemento/apidocs/</link>
                        <link>https://www.gwtproject.org/javadoc/latest/</link>
                        <link>https://javadoc.io/doc/org.gwtproject.event/gwt-event/${version.gwt.event}/</link>
                        <link>https://javadoc.io/doc/org.gwtproject.safehtml/gwt-safehtml/${version.gwt.safehtml}/</link>
                        <link>https://javadoc.io/doc/com.google.elemental2/elemental2-core/${version.elemental2}/</link>
                        <link>https://javadoc.io/doc/com.google.elemental2/elemental2-dom/${version.elemental2}/</link>
                        <link>https://javadoc.io/doc/com.google.elemental2/elemental2-promise/${version.elemental2}/</link>
                        <link>https://javadoc.io/doc/com.google.elemental2/elemental2-webstorage/${version.elemental2}/
                        </link>
                    </links>
                    <show>public</show>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>format</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.ec4j.maven</groupId>
                        <artifactId>editorconfig-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>editorconfig-format</id>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>format</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>
                        </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>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>check</id>
            <modules>
                <module>snippet-tests</module>
            </modules>
            <build>
                <plugins>
                    <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>
                        <executions>
                            <execution>
                                <id>enforcer-enforce</id>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.ec4j.maven</groupId>
                        <artifactId>editorconfig-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>editorconfig-check</id>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.revelc.code</groupId>
                        <artifactId>impsort-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>impsort-check</id>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.mycila</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>license-check</id>
                                <phase>process-sources</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>process-sources</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>apidoc</id>
            <modules>
                <module>apidoc</module>
            </modules>
        </profile>
        <profile>
            <id>quick-build</id>
            <activation>
                <property>
                    <name>quickly</name>
                </property>
            </activation>
            <properties>
                <maven.javadoc.skip>true</maven.javadoc.skip>
                <skipITs>true</skipITs>
                <skipTests>true</skipTests>
            </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.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${version.central.publishing.plugin}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                            <waitMaxTime>86400</waitMaxTime> <!-- 24h -->
                            <waitUntil>validated</waitUntil>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>showcase</id>
            <modules>
                <module>showcase</module>
            </modules>
        </profile>
    </profiles>

    <repositories>
        <repository>
            <id>central-portal-snapshots</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <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>
    <pluginRepositories>
        <pluginRepository>
            <id>jboss-nexus</id>
            <url>https://repository.jboss.org/nexus/repository/releases/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
</project>
