<?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.wildfly.plugins</groupId>
        <artifactId>wildfly-maven-plugin-parent</artifactId>
        <version>5.1.2.Final</version>
    </parent>

    <artifactId>wildfly-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <name>WildFly Maven Plugin</name>

    <description>A maven plugin that allows various management operations to be executed on WildFly Application
        Server.
    </description>

    <prerequisites>
        <!-- The minimum required Maven version -->
        <maven>3.6.3</maven>
    </prerequisites>

    <!-- The url and scm need to be defined here as the site plugin appends the maven module name -->
    <url>http://www.wildfly.org</url>
    <scm>
        <connection>${wildfly.scm.connection}</connection>
        <developerConnection>${wildfly.scm.developer.connection}</developerConnection>
        <url>${wildfly.scm.url}</url>
    </scm>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-site-plugin</artifactId>
                <configuration>
                    <skip>false</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>${version.pir.plugin}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <configuration>
                    <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                </configuration>
                <executions>
                    <execution>
                        <id>mojo-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>help-goal</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                        <configuration>
                            <helpPackageName>org.wildfly.plugin.generated</helpPackageName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.sisu</groupId>
                <artifactId>sisu-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-index</id>
                        <goals>
                            <goal>main-index</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!-- Needed my maven-core -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- dependencies to annotations -->
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <!-- Only used at compile-time -->
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-common-artifact-filters</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.galleon</groupId>
            <artifactId>galleon-maven-plugin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.galleon</groupId>
            <artifactId>galleon-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.twdata.maven</groupId>
            <artifactId>mojo-executor</artifactId>
            <version>${version.org.twdata.maven}</version>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- Required for the dev goal and the maven-execute dependency -->
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
        </dependency>
        <!-- Required for the dev goal and the maven-execute dependency -->
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-xml</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-controller-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.launcher</groupId>
            <artifactId>wildfly-launcher</artifactId>
        </dependency>
        <!-- Seems to be needed as the controller client is transitively bringing it in -->
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-protocol</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss.modules</groupId>
                    <artifactId>jboss-modules</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>wildfly-plugin-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-plugin-tools</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.channel</groupId>
            <artifactId>channel-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.channel</groupId>
            <artifactId>maven-resolver</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.prospero</groupId>
            <artifactId>prospero-metadata</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.glow</groupId>
            <artifactId>wildfly-glow-core</artifactId>
        </dependency>
        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${version.plugin.plugin}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-report-plugin</artifactId>
                <version>${version.plugin.plugin}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.4.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${version.javadoc.plugin}</version>
                <configuration>
                    <includeDependencySources>true</includeDependencySources>
                    <dependencySourceIncludes>
                        <include>org.wildfly.plugins:*</include>
                        <include>${project.groupId}:wildfly-plugin-core</include>
                    </dependencySourceIncludes>
                </configuration>
                <reportSets>
                    <reportSet><!-- by default, id = "default" -->
                        <reports><!-- select non-aggregate reports -->
                            <report>javadoc</report>
                        </reports>
                    </reportSet>
                    <reportSet><!-- aggregate reportSet, to define in poms having modules -->
                        <id>aggregate</id>
                        <inherited>false</inherited><!-- don't run aggregate in child modules -->
                        <reports>
                            <report>aggregate</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>generate-site</id>
            <activation>
                <property>
                    <name>generate.site</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-site-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>create-site</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>site</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-site</id>
                                <phase>site</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${docs.directory}</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${project.build.directory}/site</directory>
                                            <excludes>
                                                <exclude>**/checkstyle.html</exclude>
                                                <exclude>**/checkstyle.rss</exclude>
                                            </excludes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
