Files
2026-07-13 12:38:36 +08:00

198 lines
8.2 KiB
XML

<?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>
<parent>
<groupId>dev.nx.maven</groupId>
<artifactId>nx-maven-parent</artifactId>
<version>0.0.17</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>maven-batch-runner</artifactId>
<packaging>jar</packaging>
<name>Nx Maven Batch Runner</name>
<description>Batch runner for Nx Maven plugin - NO Maven compile-time dependencies</description>
<properties>
<!-- Skip deployment for this module - it's an internal tool, not published to Maven Central -->
<maven.install.skip>true</maven.install.skip>
<maven.deploy.skip>true</maven.deploy.skip>
<maven.gpg.skip>true</maven.gpg.skip>
</properties>
<dependencies>
<!-- Shared Nx Maven utilities -->
<dependency>
<groupId>dev.nx.maven</groupId>
<artifactId>nx-maven-shared</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Plexus ClassWorlds - needed for ClassRealm to load Maven JARs at runtime -->
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
<version>2.8.0</version>
<scope>compile</scope>
</dependency>
<!-- Logging - MUST be shaded (runtime doesn't guarantee it) -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>compile</scope>
</dependency>
<!-- JSON parsing - MUST be shaded (not part of Maven) -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</dependency>
<!-- Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Logging for testing -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>2.0.9</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Kotlin Compiler -->
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Java Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<!-- Failsafe for Integration Tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Shade Plugin for uber JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<outputFile>${project.build.directory}/batch-runner.jar</outputFile>
<minimizeJar>false</minimizeJar>
<!-- Relocate SLF4J to avoid conflicts with Maven's SLF4J in ClassRealm -->
<relocations>
<relocation>
<pattern>org.slf4j</pattern>
<shadedPattern>dev.nx.maven.shaded.slf4j</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>dev.nx.maven.NxMavenBatchRunnerKt</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
<!-- Exclude shared classes that have SLF4J dependencies from batch-runner shaded JAR.
These are included in the adapter JARs and loaded into ClassRealm.
batch-runner relocates SLF4J, which would cause method signature mismatches
if these classes were included (e.g., PathUtils methods would expect
dev.nx.maven.shaded.slf4j.Logger instead of org.slf4j.Logger). -->
<filter>
<artifact>dev.nx.maven:nx-maven-shared</artifact>
<excludes>
<exclude>dev/nx/maven/shared/BuildState*.class</exclude>
<exclude>dev/nx/maven/shared/PathUtils*.class</exclude>
</excludes>
</filter>
</filters>
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>true</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
</build>
</project>