<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.noumenadigital.platform</groupId>
        <artifactId>parent-pom</artifactId>
        <version>2024.2.8</version>
        <relativePath>../parent-pom</relativePath>
    </parent>

    <packaging>maven-plugin</packaging>

    <artifactId>npl-maven-plugin</artifactId>
    <name>${project.artifactId}</name>
    <description>The NPL compiler as a Maven plugin build tool for command line execution</description>
    <url>https://documentation.noumenadigital.com/</url>

    <licenses>
        <license>
            <name>NPL Maven Plugin License</name>
            <url>https://noumenadigital.com/npl-maven-plugin/</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <organization>Noumena Digital</organization>
            <organizationUrl>https://noumenadigital.com/</organizationUrl>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/NoumenaDigital/platform</url>
    </scm>

    <properties>
        <maven.version>3.8.1</maven.version>
        <!-- org.apache.maven.plugin-tools has a different release cycle to org.apache.maven -->
        <maven-plugin.version>3.7.0</maven-plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>language-builtins</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>testing</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven.version}</version>
            <exclusions>
                <exclusion>
                    <!-- Avoid triggering duplicate-finder-maven-plugin due to conflict with jakarta.annotation:jakarta.annotation-api. -->
                    <groupId>javax.annotation</groupId>
                    <artifactId>jsr250-api</artifactId>
                </exclusion>
            </exclusions>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven.version}</version>
            <exclusions>
                <exclusion>
                    <!-- Avoid triggering duplicate-finder-maven-plugin due to conflict with org.springframework:spring-aop -->
                    <groupId>aopalliance</groupId>
                    <artifactId>aopalliance</artifactId>
                </exclusion>
            </exclusions>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>${maven-plugin.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>engine-client-codegen</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>pumlgen</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>multinode-codegen</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>npl-api</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>storage-persistent</artifactId>
                </exclusion>

            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>kotlin-maven-plugin</artifactId>
                <groupId>org.jetbrains.kotlin</groupId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${maven-plugin.version}</version>
                <configuration>
                    <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                </configuration>
                <executions>
                    <execution>
                        <id>mojo-descriptor</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.basedir}/src/main/java</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-test-source</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.basedir}/src/test/java</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-dependencies</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <!-- Noumena "secret sauce" as determined by the TechBoard -->
                                        <exclude>com.noumenadigital.platform:storage-persistent</exclude>
                                        <exclude>com.noumenadigital.platform:history</exclude>
                                        <exclude>com.noumenadigital.platform:history-services</exclude>
                                        <exclude>com.noumenadigital.platform:history-storage</exclude>
                                        <exclude>com.noumenadigital.platform:*-tests</exclude>
                                    </excludes>
                                    <searchTransitive>true</searchTransitive>
                                    <message>Prohibited dependencies found in build!</message>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
