<?xml version="1.0" encoding="UTF-8"?>
<!--
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// © 2011-2022 Telenav, Inc.
// Licensed under Apache License, Version 2.0
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-->
<project xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns = "http://maven.apache.org/POM/4.0.0"
         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>com.telenav.cactus</groupId>
        <artifactId>cactus</artifactId>
        <version>1.5.0</version>
    </parent>

    <artifactId>cactus-maven-plugin</artifactId>

    <packaging>maven-plugin</packaging>
    <description>
        The cactus-maven-plugin project codifies Telenav Open Source processes.
    </description>

    <properties>
        <enforcer.skip>true</enforcer.skip>
        <!--<maven.javadoc.skip>true</maven.javadoc.skip>-->
        <mastfrog.version>2.8.3</mastfrog.version>
        <!-- this must be overridden here only to use the previous version,
        or it will fail trying to process itself while it is being built -->
        <cactus.maven.plugin.versions>${cactus.previous.version}</cactus.maven.plugin.versions>
        <java.module.name>cactus.maven.plugin</java.module.name>
    </properties>

    <dependencies>

        <!-- Cactus -->

        <dependency>
            <groupId>com.telenav.cactus</groupId>
            <artifactId>cactus-git</artifactId>
        </dependency>
        <dependency>
            <groupId>com.telenav.cactus</groupId>
            <artifactId>cactus-metadata</artifactId>
        </dependency>
        <dependency>
            <groupId>com.telenav.cactus</groupId>
            <artifactId>cactus-maven-xml</artifactId>
        </dependency>
        <dependency>
            <groupId>com.telenav.cactus</groupId>
            <artifactId>cactus-maven-versioning</artifactId>
        </dependency>
        <dependency>
            <groupId>com.telenav.cactus</groupId>
            <artifactId>cactus-codeflowers</artifactId>
        </dependency>

        <!-- Mastfrog -->

        <dependency>
            <groupId>com.mastfrog</groupId>
            <artifactId>util-streams</artifactId>
        </dependency>

        <!-- Maven -->

        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <compilerArgs>
                        <arg>--add-reads</arg>
                        <arg>cactus.maven.plugin=ALL-UNNAMED</arg>
                    </compilerArgs>
                </configuration>
                <version>${maven-compiler-plugin.version}</version>
            </plugin>
            
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                    <additionalOptions>--add-reads cactus.maven.plugin=ALL-UNNAMED</additionalOptions>
                </configuration>
            </plugin>

            <plugin>

                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <configuration>
                    <goalPrefix>cactus</goalPrefix>
                </configuration>
                <executions>
                    <!-- We need this for release, so that we can use compile, but 
                         but not install, to pre-generate the plugin descriptor so that 
                         the rest of the build, which will use this plugin from
                         target/classes, does not fail because there is no plugin.xml
                         in META-INF.  Harmless to do it earlier, since we're not using
                         any odd scripting languages.
                    -->
                    <execution>
                        <id>mojo-descriptor-compile-time</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                    
                    <execution>
                        <id>mojo-descriptor</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>generated-helpmojo</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>

            </plugin>

        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>${maven.plugin.plugin.version}</version>
                </plugin>
            </plugins>

        </pluginManagement>
    </build>
</project>
