<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2019 Red Hat, Inc.
  ~
  ~ 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>wildscribe-parent</artifactId>
        <groupId>org.jboss.wildscribe</groupId>
        <version>3.1.0.Final</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>wildscribe-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>

    <prerequisites>
        <maven>${maven.min.version}</maven>
    </prerequisites>

    <properties>
        <plugin.site>${project.reporting.outputDirectory}</plugin.site>

        <!-- documentation properties -->
        <appServerName>WildFly</appServerName>
        <pluginPrefix>wildscribe</pluginPrefix>
        <mavenMinVersion>${maven.min.version}</mavenMinVersion>

        <wildfly.scm.connection>scm:git://github.com/wildscribe/wildscribe.git</wildfly.scm.connection>
        <wildfly.scm.developer.connection>scm:git:git@github.com:wildscribe/wildscribe.git
        </wildfly.scm.developer.connection>
        <wildfly.scm.url>http://github.com/wildscribe/wildscribe</wildfly.scm.url>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <configuration>
                    <!-- The HelpMojo is generated and should be skipped -->
                    <excludes>**/HelpMojo.java</excludes>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-site-plugin</artifactId>
                <configuration>
                    <skip>false</skip>
                    <relativizeDecorationLinks>false</relativizeDecorationLinks>
                    <outputDirectory>${plugin.site}</outputDirectory>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>${version.pir.plugin}</version>
            </plugin>
            <plugin>
                <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.jboss.wildscribe.plugins</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>

    <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>
        </plugins>
    </reporting>

    <dependencies>
        <!-- Needed my maven-core -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
        </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.eclipse.aether</groupId>
            <artifactId>aether-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-cli</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss.logging</groupId>
                    <artifactId>jboss-logging-processor</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-controller-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-launcher</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-plugin-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-plugin-tools</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.wildscribe</groupId>
            <artifactId>wildscribe-model-dumper</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.wildscribe</groupId>
            <artifactId>message-dumper</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.wildscribe</groupId>
            <artifactId>wildscribe-site-generator</artifactId>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>generate-docs</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-site-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>create-site</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>site</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <configuration>
                            <outputDirectory>${project.basedir}/../docs/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.reporting.outputDirectory}</directory>
                                </resource>
                            </resources>
                        </configuration>
                        <executions>
                            <execution>
                                <id>copy-site</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>