build(io): split release into Console + GUI jars and slim the console jar

Replace the single HauntedManor.jar with two self-contained jars, one per
entry point (HauntedManor-Console.jar -> App, HauntedManor-GUI.jar -> AppGui),
each with its own Main-Class so both run via plain `java -jar`.

The console jar omits the OGG decode libraries and the ~11 MB of music tracks
(GameIO.setMusic is a no-op in text mode), dropping it from 17 MB to ~5 MB.
README documents running each jar.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-02 10:31:36 +02:00
parent 41c79c3b96
commit 8e63f21c7d
4 changed files with 53 additions and 10 deletions

View File

@@ -26,14 +26,17 @@ werden aus YAML-Dateien geladen, nicht im Code festverdrahtet.
## Schnellstart ohne Maven ## Schnellstart ohne Maven
Im Ordner [`release/`](release/) liegt eine fertig gebaute, eigenständige JAR Im Ordner [`release/`](release/) liegen zwei fertig gebaute, eigenständige
(`HauntedManor.jar`) mit allen Abhängigkeiten. Sie braucht nur Java 25: JARs mit allen Abhängigkeiten je eine pro Frontend. Sie brauchen nur Java 25:
```bash ```bash
java -jar release/HauntedManor.jar # Konsolen-Version java -jar release/HauntedManor-Console.jar # Konsolen-Version (~5 MB, ohne Audio)
java -cp release/HauntedManor.jar thb.jeanluc.adventure.AppGui # Swing-GUI java -jar release/HauntedManor-GUI.jar # Swing-GUI (~17 MB, mit Musik)
``` ```
Die Konsolen-JAR enthält weder die Musikdateien noch die OGG-Bibliotheken
der Textmodus spielt keine Musik, daher werden sie dort weggelassen.
## Bauen und Testen ## Bauen und Testen
Mit dem Wrapper (empfohlen, keine Maven-Installation nötig) unter Windows Mit dem Wrapper (empfohlen, keine Maven-Installation nötig) unter Windows
@@ -41,7 +44,7 @@ Mit dem Wrapper (empfohlen, keine Maven-Installation nötig) unter Windows
```bash ```bash
./mvnw clean test # alle Tests ausführen (233 Tests) ./mvnw clean test # alle Tests ausführen (233 Tests)
./mvnw clean package # baut die eigenständige JAR nach release/HauntedManor.jar ./mvnw clean package # baut beide JARs nach release/ (Console + GUI)
``` ```
Ein systemweit installiertes `mvn` funktioniert identisch (`mvn clean test` …). Ein systemweit installiertes `mvn` funktioniert identisch (`mvn clean test` …).

View File

@@ -113,25 +113,65 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version> <version>3.6.0</version>
<!-- Two self-contained jars in release/: one per entry point.
createDependencyReducedPom is off globally so no stray pom is written. -->
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions> <executions>
<!-- Console version -> release/HauntedManor-Console.jar -->
<execution> <execution>
<id>shade-console</id>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<configuration> <configuration>
<!-- Self-contained, runnable JAR with all dependencies bundled. --> <outputFile>${project.basedir}/release/HauntedManor-Console.jar</outputFile>
<outputFile>${project.basedir}/release/HauntedManor.jar</outputFile> <!-- Console has no audio (GameIO.setMusic is a no-op there), so leave
<createDependencyReducedPom>false</createDependencyReducedPom> out the OGG decode libraries and the ~11 MB of music tracks. -->
<artifactSet>
<excludes>
<exclude>com.googlecode.soundlibs:vorbisspi</exclude>
<exclude>com.googlecode.soundlibs:jorbis</exclude>
</excludes>
</artifactSet>
<filters>
<filter>
<artifact>thb.jeanluc:Semesterprojekt</artifact>
<excludes>
<exclude>music/**</exclude>
</excludes>
</filter>
</filters>
<transformers> <transformers>
<!-- Default entry point: console version. GUI via -cp ... AppGui. -->
<transformer <transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries> <manifestEntries>
<Main-Class>thb.jeanluc.adventure.App</Main-Class> <Main-Class>thb.jeanluc.adventure.App</Main-Class>
</manifestEntries> </manifestEntries>
</transformer> </transformer>
<!-- Merge META-INF/services so the OGG Vorbis SPI keeps working. --> <transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
<!-- Swing GUI version -> release/HauntedManor-GUI.jar -->
<execution>
<id>shade-gui</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<outputFile>${project.basedir}/release/HauntedManor-GUI.jar</outputFile>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>thb.jeanluc.adventure.AppGui</Main-Class>
</manifestEntries>
</transformer>
<transformer <transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers> </transformers>

Binary file not shown.