<?xml version="1.0" encoding="UTF-8"?>
<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>

    <groupId>com.metaeffekt.artifact.analysis</groupId>

    <artifactId>ae-artifact-analysis-pom</artifactId>
    <name>${project.artifactId}</name>
    <version>0.159.2</version>
    <packaging>pom</packaging>

    <parent>
        <groupId>org.metaeffekt.core</groupId>
        <artifactId>ae-core</artifactId>
        <version>0.156.2</version>
    </parent>

    <description>Support for artifact analysis</description>
    <url>https://metaeffekt.com</url>

    <organization>
        <name>metaeffekt GmbH</name>
        <url>http://metaeffekt.com</url>
    </organization>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>file://ae-artifact-analysis/src/main/resources/META-INF/LICENSE</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git://ae-server:7990/scm/ae/metaeffekt-artifact-analysis.git</connection>
        <developerConnection>scm:git:ssh://ae-server:7990/scm/ae/metaeffekt-artifact-analysis.git</developerConnection>
        <url>http://ae-server:7990/projects/AE/repos/metaeffekt-artifact-analysis/browse</url>
    </scm>

    <developers>
        <developer>
            <email>contact@metaeffekt.com</email>
            <organization>metaeffekt GmbH</organization>
            <organizationUrl>http://metaeffekt.com</organizationUrl>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <ae.core.version>0.156.2</ae.core.version>
        <ae.artifact.analysis.version>0.159.2</ae.artifact.analysis.version>

        <artifact.inventory.version>${ae.core.version}</artifact.inventory.version>
        <artifact.inventory.enabled>false</artifact.inventory.enabled>

        <org.spdx.useJARLicenseInfoOnly>true</org.spdx.useJARLicenseInfoOnly>

        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <maven.compiler.jdk>17</maven.compiler.jdk>

        <organization>metaeffekt.com</organization>

        <license.identifier>Apache License 2.0</license.identifier>
        <license.file>/META-INF/LICENSE</license.file>

        <includedTestGroups />
        <excludedTestGroups>slow, org.junit.jupiter.api.Disabled, scancode</excludedTestGroups>
        <excludedJUnit5Engines />

        <!-- overwrite only in case the warning cannot be fixed from a technical viewpoint -->
        <failOnJavadocWarn>true</failOnJavadocWarn>
        <failOnJavadocError>true</failOnJavadocError>
        <!-- Handles javadoc errors with reference to kotlin. In standard cases, leave empty. -->
        <javadocSourcePath></javadocSourcePath>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.metaeffekt.artifact.analysis</groupId>
                <artifactId>ae-artifact-analysis</artifactId>
                <version>${ae.artifact.analysis.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${google.guava.version}</version>
                <type>jar</type>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>javax.annotation</groupId>
                <artifactId>javax.annotation-api</artifactId>
                <version>${javax.annotation-api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.metaeffekt.core</groupId>
                <artifactId>ae-core-plugin-dependency-management-pom</artifactId>
                <version>${ae.core.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-util</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-core</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-api</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-netty</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-protobuf</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-stub</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java-util</artifactId>
                <version>${google.protobuf.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-core</artifactId>
                <version>${maven.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-slf4j2-impl</artifactId>
                <version>${log4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <version>${log4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
                <version>${log4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.velocity</groupId>
                <artifactId>velocity-engine-core</artifactId>
                <version>${velocity.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-collections</groupId>
                <artifactId>commons-collections</artifactId>
                <version>${commons.collections3.version}</version>
            </dependency>
            <dependency>
                <groupId>org.yaml</groupId>
                <artifactId>snakeyaml</artifactId>
                <version>${snakeyaml.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven.jar.plugin.version}</version>
                    <configuration>
                        <archive>
                            <index>false</index>
                            <addMavenDescriptor>false</addMavenDescriptor>
                            <manifestEntries>
                                <Created-By>${organization}</Created-By>
                                <Built-By>${organization}</Built-By>
                            </manifestEntries>
                            <manifestSections>
                                <manifestSection>
                                    <name>License Information</name>
                                    <manifestEntries>
                                        <License>${license.identifier}</License>
                                        <License-File>${license.file}</License-File>
                                    </manifestEntries>
                                </manifestSection>
                            </manifestSections>
                        </archive>
                    </configuration>
                </plugin>

                <plugin>
                    <!-- introduced to manage version and test selection -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.plugin.version}</version>
                    <configuration>
                        <groups>${includedTestGroups}</groups>
                        <excludedGroups>${excludedTestGroups}</excludedGroups>
                        <excludeJUnit5Engines>${excludedJUnit5Engines}</excludeJUnit5Engines>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${maven.license.plugin.version}</version>
                    <configuration>
                        <licenseSets>
                            <licenseSet>
                                <header>header/apache-license-2.0-header.txt</header>
                                <properties>
                                    <owner>metaeffekt.org</owner>
                                    <email>contact@metaeffekt.org</email>
                                    <year.initial>2021</year.initial>
                                    <year>2026</year>
                                </properties>
                                <includes>
                                    <include>**/*.java</include>
                                    <include>**/*.kt</include>
                                    <include>**/*.ts</include>
                                    <include>**/*.tsx</include>
                                </includes>
                                <excludes>
                                    <exclude>**/README*</exclude>
                                    <exclude>src/test/resources/**</exclude>
                                    <exclude>src/main/resources/**</exclude>
                                    <exclude>**/.*/**</exclude>
                                    <exclude>**/src/generated/**</exclude>
                                </excludes>
                            </licenseSet>
                        </licenseSets>
                        <mapping>
                            <tsx>SLASHSTAR_STYLE</tsx>
                            <ts>SLASHSTAR_STYLE</ts>
                        </mapping>
                    </configuration>
                    <executions>
                        <execution>
                            <id>check-license-header</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.metaeffekt.core</groupId>
                            <artifactId>ae-configuration</artifactId>
                            <version>${ae.core.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>

        <profile>
            <id>update-versions</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.metaeffekt.core</groupId>
                        <artifactId>ae-version-maven-plugin</artifactId>
                        <version>${ae.core.version}</version>
                        <configuration>
                            <projectVersion>${ae.artifact.analysis.version}</projectVersion>
                            <groupIdVersionMap>
                                <org.metaeffekt.core>${ae.core.version}</org.metaeffekt.core>
                                <com.metaeffekt.artifact.analysis>${ae.artifact.analysis.version}</com.metaeffekt.artifact.analysis>
                            </groupIdVersionMap>
                            <propertyVersionMap>
                                <ae.core.version>${ae.core.version}</ae.core.version>
                                <ae.artifact.analysis.version>${ae.artifact.analysis.version}</ae.artifact.analysis.version>
                                <artifact.inventory.enabled>false</artifact.inventory.enabled>
                            </propertyVersionMap>
                            <includes>**/pom.xml</includes>
                            <excludes>**/.*/**,**/target/**,**/npm-module/**</excludes>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>pre-clean</phase>
                                <goals>
                                    <goal>update</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>dev</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <modules>
                <module>modules</module>
                <module>npm-modules</module>
                <module>plugins</module>

                <!-- dev profile adds additional tests -->
                <module>tests</module>
            </modules>
        </profile>

        <profile>
            <id>pre-deploy</id>
            <modules>
                <module>modules</module>
                <module>npm-modules</module>
                <module>plugins</module>
            </modules>
        </profile>

        <profile>
            <id>deploy</id>

            <modules>
                <module>modules</module>
                <module>npm-modules</module>
                <module>plugins</module>
            </modules>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${maven.central.publishing.plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <executable>gpg</executable>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>generate-javadoc-jar</id>
            <activation>
                <file><exists>src/main/java</exists></file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven.source.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <includePom>false</includePom>
                            <excludeResources>false</excludeResources>

                            <archive>
                                <index>false</index>
                                <addMavenDescriptor>false</addMavenDescriptor>
                                <manifestEntries>
                                    <Created-By>${organization}</Created-By>
                                    <Built-By>${organization}</Built-By>
                                </manifestEntries>
                                <manifestSections>
                                    <manifestSection>
                                        <name>License Information</name>
                                        <manifestEntries>
                                            <License>${license.identifier}</License>
                                            <License-File>${license.file}</License-File>
                                        </manifestEntries>
                                    </manifestSection>
                                </manifestSections>
                            </archive>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <source>17</source>
                            <javadocVersion>${java.version}</javadocVersion>
                            <show>public</show>
                            <failOnError>${failOnJavadocError}</failOnError>
                            <failOnWarnings>${failOnJavadocWarn}</failOnWarnings>
                            <sourcepath>${javadocSourcePath}</sourcepath>

                            <additionalOptions>
                                <!-- disable specific checks (HTML) but keep others intact -->
                                <additionalOption>-Xdoclint:all,-html</additionalOption>
                            </additionalOptions>

                            <bottom>
                                Licensed under the ${license.identifier} - Copyright &#169; {inceptionYear} &#x2021;
                                {currentYear} the original author or authors.
                            </bottom>
                            <archive>
                                <index>false</index>
                                <addMavenDescriptor>false</addMavenDescriptor>
                                <manifestEntries>
                                    <Created-By>${organization}</Created-By>
                                    <Built-By>${organization}</Built-By>
                                </manifestEntries>
                                <manifestSections>
                                    <manifestSection>
                                        <name>License Information</name>
                                        <manifestEntries>
                                            <License>${license.identifier}</License>
                                        </manifestEntries>
                                    </manifestSection>
                                </manifestSections>
                            </archive>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>apply-license-header</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>com.mycila</groupId>
                            <artifactId>license-maven-plugin</artifactId>
                            <version>${maven.license.plugin.version}</version>
                            <executions>
                                <execution>
                                    <id>apply-license-header</id>
                                    <phase>validate</phase>
                                    <goals>
                                        <goal>format</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <licenseSets>
                                    <licenseSet>
                                        <header>header/apache-license-2.0-header.txt</header>
                                        <properties>
                                            <owner>metaeffekt.org</owner>
                                            <email>contact@metaeffekt.org</email>
                                            <year.initial>2021</year.initial>
                                            <year>2026</year>
                                        </properties>
                                        <includes>
                                            <include>**/*.java</include>
                                            <include>**/*.kt</include>
                                            <include>**/*.ts</include>
                                            <include>**/*.tsx</include>
                                        </includes>
                                        <excludes>
                                            <exclude>**/README*</exclude>
                                            <exclude>src/test/resources/**</exclude>
                                            <exclude>src/main/resources/**</exclude>
                                            <exclude>**/.test/**</exclude>
                                            <exclude>**/.workbench/**/*</exclude>
                                        </excludes>
                                    </licenseSet>
                                </licenseSets>
                                <mapping>
                                    <tsx>SLASHSTAR_STYLE</tsx>
                                    <ts>SLASHSTAR_STYLE</ts>
                                </mapping>
                            </configuration>
                            <dependencies>
                                <dependency>
                                    <groupId>org.metaeffekt.core</groupId>
                                    <artifactId>ae-configuration</artifactId>
                                    <version>${ae.core.version}</version>
                                </dependency>
                            </dependencies>
                        </plugin>
                    </plugins>
                </pluginManagement>

                <plugins>
                    <plugin>
                        <groupId>com.mycila</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                    </plugin>
                </plugins>

            </build>
        </profile>

        <!-- Profile for slow tests -->
        <profile>
            <id>slow-tests</id>
            <modules>
                <module>modules</module>
                <module>tests/ae-scan-preprocess-itest</module>
            </modules>
            <properties>
                <includedTestGroups>slow</includedTestGroups>
                <!-- Override to remove 'slow' from excluded groups -->
                <excludedTestGroups>org.junit.jupiter.api.Disabled</excludedTestGroups>
                <excludedJUnit5Engines>kotest</excludedJUnit5Engines>
            </properties>
        </profile>

        <!-- Profile for scancode-service integration tests -->
        <profile>
            <id>scancode-service-tests</id>
            <modules>
                <module>tests/ae-scancode-toolkit-itest</module>
            </modules>
            <properties>
                <includedTestGroups>scancode</includedTestGroups>
                <!-- Override to remove 'slow' from excluded groups -->
                <excludedTestGroups>org.junit.jupiter.api.Disabled</excludedTestGroups>
            </properties>
        </profile>

    </profiles>

</project>
