<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>de.gecheckt</groupId>
    <artifactId>pdf-umbenenner-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <artifactId>pdf-umbenenner-bootstrap</artifactId>
  <packaging>jar</packaging>

  <dependencies>
    <!-- Internal dependencies -->
    <dependency>
      <groupId>de.gecheckt</groupId>
      <artifactId>pdf-umbenenner-domain</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>de.gecheckt</groupId>
      <artifactId>pdf-umbenenner-application</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>de.gecheckt</groupId>
      <artifactId>pdf-umbenenner-adapter-in-cli</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>de.gecheckt</groupId>
      <artifactId>pdf-umbenenner-adapter-in-gui</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>de.gecheckt</groupId>
      <artifactId>pdf-umbenenner-adapter-out</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Logging -->
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j2-impl</artifactId>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!--
        Shade plugin: produces the single executable JAR containing all modules,
        including the JavaFX runtime for the Windows GUI start path.

        JavaFX integration notes:
        - JavaFX platform-specific JARs (win classifier) are pulled in transitively
          through pdf-umbenenner-adapter-in-gui. They contain native DLLs that JavaFX
          extracts to a temporary directory at runtime.
        - The main class (PdfUmbenennerApplication) intentionally does NOT extend
          javafx.application.Application. This avoids the JavaFX module-system launcher
          check that blocks fat-JAR execution. The GUI path uses
          Application.launch(PdfUmbenennerGuiApplication.class, ...) explicitly.
        - The headless start path never initialises the JavaFX Application class.
          GuiAdapter is only instantiated and started when StartupMode is GUI.
        - No EXE wrapper or installer is produced; the JAR is the sole artefact.
      -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>de.gecheckt.pdf.umbenenner.bootstrap.PdfUmbenennerApplication</mainClass>
                </transformer>
                <!-- Merge META-INF/services entries from all JARs instead of overwriting -->
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
              </transformers>
              <filters>
                <filter>
                  <!--
                    Exclude signature files and module descriptors from all dependencies.
                    - Signature files (*.SF, *.DSA, *.RSA): signed JARs (including JavaFX)
                      produce invalid signatures once repackaged, causing SecurityException.
                    - module-info.class: JavaFX ships JPMS module descriptors that conflict
                      when merged into a single non-modular fat JAR.
                  -->
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>module-info.class</exclude>
                    <exclude>META-INF/versions/*/module-info.class</exclude>
                  </excludes>
                </filter>
              </filters>
              <createDependencyReducedPom>false</createDependencyReducedPom>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>