<?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>dev.mccue</groupId>
    <artifactId>jresolve-cli</artifactId>
    <version>2024.05.09</version>

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jdk.version>21.0.3</jdk.version>
    </properties>

    <name>jresolve-cli</name>
    <description>CLI for resolving dependencies on the JVM</description>
    <url>https://github.com/bowbahdoe/jresolve-cli</url>

    <developers>
        <developer>
            <name>Ethan McCue</name>
            <email>ethan@mccue.dev</email>
            <organization>McCue Software Solutions</organization>
            <organizationUrl>https://www.mccue.dev</organizationUrl>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git://github.com/bowbahdoe/jresolve-cli.git</connection>
        <developerConnection>scm:git:ssh://github.com:bowbahdoe/jresolve-cli.git</developerConnection>
        <url>http://github.com/bowbahdoe/jresolve-cli/tree/main</url>
    </scm>


    <dependencies>
        <dependency>
            <groupId>info.picocli</groupId>
            <artifactId>picocli</artifactId>
            <version>4.7.5</version>
        </dependency>
        <dependency>
            <groupId>dev.mccue</groupId>
            <artifactId>resolve</artifactId>
            <version>2024.04.21</version>
        </dependency>
        <dependency>
            <groupId>dev.mccue</groupId>
            <artifactId>json</artifactId>
            <version>2023.12.23</version>
        </dependency>
        <dependency>
            <groupId>dev.mccue</groupId>
            <artifactId>purl</artifactId>
            <version>2023.11.07</version>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>picocli-codegen</id>
            <dependencies>
                <dependency>
                    <groupId>info.picocli</groupId>
                    <artifactId>picocli-codegen</artifactId>
                    <version>4.7.5</version>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.4.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <doclint>none</doclint>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-source</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jreleaser</groupId>
                        <artifactId>jreleaser-maven-plugin</artifactId>
                        <version>1.11.0</version>
                        <configuration>
                            <jreleaser>
                                <project>
                                    <copyright>2024</copyright>
                                    <versionPattern><type>CHRONVER</type></versionPattern>
                                </project>
                                <signing>
                                    <active>ALWAYS</active>
                                    <armored>true</armored>
                                </signing>
                                <deploy>
                                    <maven>
                                        <nexus2>
                                            <maven-central>
                                                <active>ALWAYS</active>
                                                <url>https://s01.oss.sonatype.org/service/local</url>;
                                                <closeRepository>true</closeRepository>
                                                <releaseRepository>true</releaseRepository>
                                                <stagingRepositories>target/staging-deploy</stagingRepositories>
                                            </maven-central>
                                        </nexus2>
                                    </maven>
                                </deploy>
                            </jreleaser>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>uberjar</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>3.5.3</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <relocations>
                                <relocation>
                                    <pattern>picocli</pattern>
                                    <shadedPattern>dev.mccue.resolve.uber.picocli</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>dev.mccue</pattern>
                                    <shadedPattern>dev.mccue.resolve.uber</shadedPattern>
                                </relocation>
                            </relocations>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>dev.mccue.resolve.uber.resolve.cli.CliMain</mainClass>
                                </transformer>
                            </transformers>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>module-info.class</exclude>
                                        <exclude>META-INF/versions/*/module-info.class</exclude>
                                    </excludes>
                                </filter>
                                <filter>
                                    <artifact>dev.mccue:json</artifact>
                                    <excludes>
                                        <exclude>META-INF/MANIFEST.MF</exclude>
                                    </excludes>
                                </filter>
                                <filter>
                                    <artifact>info.picocli:picocli</artifact>
                                    <excludes>
                                        <exclude>META-INF/MANIFEST.MF</exclude>
                                    </excludes>
                                </filter>
                                <filter>
                                    <artifact>dev.mccue:purl</artifact>
                                    <excludes>
                                        <exclude>META-INF/MANIFEST.MF</exclude>
                                    </excludes>
                                </filter>
                                <filter>
                                    <artifact>dev.mccue:resolve</artifact>
                                    <excludes>
                                        <exclude>META-INF/MANIFEST.MF</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <shadedClassifierName>uber</shadedClassifierName>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.moditect</groupId>
                        <artifactId>moditect-maven-plugin</artifactId>
                        <version>1.2.1.Final</version>
                        <executions>
                            <execution>
                                <id>add-module-info</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>add-module-info</goal>
                                </goals>
                                <configuration>
                                    <overwriteExistingFiles>true</overwriteExistingFiles>
                                    <modules>
                                        <module>
                                            <file>target/jresolve-cli-2024.05.09-uber.jar</file>
                                            <moduleInfoFile>
                                                src/main/uberjar/module-info.java
                                            </moduleInfoFile>
                                        </module>
                                    </modules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>dev.mccue.resolve.cli.CliMain</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

        </plugins>
    </build>
</project>