aboutsummaryrefslogtreecommitdiff
path: root/pom.xml
blob: fde6de05892466358fbd73fca63b1e9ce6027a4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
<?xml version="1.0"?>
<project
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
  xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <modelVersion>4.0.0</modelVersion>

  <groupId>eu.mulk</groupId>
  <artifactId>aendggner</artifactId>
  <version>${revision}</version>

  <properties>
    <maven.compiler.parameters>true</maven.compiler.parameters>
    <maven.compiler.release>21</maven.compiler.release>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <enforced.maven-version>3.9.0</enforced.maven-version>

    <build-helper-plugin.version>3.6.0</build-helper-plugin.version>
    <clean-plugin.version>3.3.2</clean-plugin.version>
    <compiler-plugin.version>3.15.0</compiler-plugin.version>
    <dependency-plugin.version>3.11.0</dependency-plugin.version>
    <enforcer-plugin.version>3.6.3</enforcer-plugin.version>
    <exec-plugin.version>3.6.3</exec-plugin.version>
    <jar-plugin.version>3.5.0</jar-plugin.version>
    <resources-plugin.version>3.5.0</resources-plugin.version>
    <spotless-plugin.version>3.8.0</spotless-plugin.version>
    <surefire-plugin.version>3.5.6</surefire-plugin.version>

    <google.java.format.version>1.28.0</google.java.format.version>

    <assertj.version>3.27.7</assertj.version>
    <java-diff-utils.version>4.17</java-diff-utils.version>
    <jboss-logging.version>3.6.3.Final</jboss-logging.version>
    <jzlib.version>1.1.5</jzlib.version>
    <jspecify.version>1.0.0</jspecify.version>
    <junit.version>5.13.4</junit.version>
    <pdfbox.version>3.0.8</pdfbox.version>
    <picocli.version>4.7.7</picocli.version>
    <slf4j.version>2.0.18</slf4j.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>

    <!-- Annotations -->
    <dependency>
      <groupId>org.jspecify</groupId>
      <artifactId>jspecify</artifactId>
      <version>${jspecify.version}</version>
    </dependency>

    <!-- Command line parsing -->
    <dependency>
      <groupId>info.picocli</groupId>
      <artifactId>picocli</artifactId>
      <version>${picocli.version}</version>
    </dependency>

    <!-- Logging -->
    <dependency>
      <groupId>org.jboss.logging</groupId>
      <artifactId>jboss-logging</artifactId>
      <version>${jboss-logging.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <version>${slf4j.version}</version>
    </dependency>

    <!-- PDF text extraction -->
    <dependency>
      <groupId>org.apache.pdfbox</groupId>
      <artifactId>pdfbox</artifactId>
      <version>${pdfbox.version}</version>
    </dependency>

    <!-- Text diffing -->
    <dependency>
      <groupId>io.github.java-diff-utils</groupId>
      <artifactId>java-diff-utils</artifactId>
      <version>${java-diff-utils.version}</version>
    </dependency>

    <!-- Testing -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>${assertj.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>

    <!--
      Der Beispielkorpus liegt unter src/test/resources, wird aber von den Tests über
      Dateisystempfade gelesen, nicht über den Klassenpfad. Eine Kopie nach
      target/test-classes wäre deshalb bei jedem Bau 35 MB umsonst.
    -->
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <excludes>
          <exclude>sampledata/**</exclude>
        </excludes>
      </testResource>
    </testResources>

    <pluginManagement>
      <plugins>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <configuration>
            <generateBackupPoms>false</generateBackupPoms>
          </configuration>
        </plugin>

      </plugins>
    </pluginManagement>

    <plugins>

      <!-- Compiler -->
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${compiler-plugin.version}</version>
        <configuration>
          <annotationProcessorPaths>
            <path>
              <groupId>info.picocli</groupId>
              <artifactId>picocli-codegen</artifactId>
              <version>${picocli.version}</version>
            </path>
          </annotationProcessorPaths>
          <compilerArgs>
            <arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
          </compilerArgs>
        </configuration>
      </plugin>

      <!-- Resources -->
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>${resources-plugin.version}</version>
      </plugin>

      <!-- Tests -->
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
      </plugin>

      <!-- Google Java Code Formatter, for enforcing style conventions -->
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>${spotless-plugin.version}</version>
        <configuration>
          <java>
            <removeUnusedImports/>
            <importOrder>
              <order>java,javax,org,com,de,io,dagger,eu.mulk,</order>
            </importOrder>
            <googleJavaFormat>
              <version>${google.java.format.version}</version>
              <style>GOOGLE</style>
            </googleJavaFormat>
          </java>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>${enforcer-plugin.version}</version>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>${enforced.maven-version}</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>${exec-plugin.version}</version>
        <configuration>
          <mainClass>eu.mulk.aendggner.AendGgner</mainClass>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>${dependency-plugin.version}</version>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>
                ${project.build.directory}/libs
              </outputDirectory>
              <includeScope>runtime</includeScope>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${jar-plugin.version}</version>
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <classpathPrefix>libs/</classpathPrefix>
              <mainClass>
                eu.mulk.aendggner.AendGgner
              </mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>

    </plugins>

  </build>

  <profiles>

    <!--
      Browserfassung: übersetzt dieselbe Pipeline mit GraalVM Web Image nach WebAssembly.
      Ausdrücklich anzufordern (`-Pwasm`); der Standard-Build bleibt unberührt und braucht
      kein GraalVM.

      Voraussetzung: Oracle GraalVM 25.1+ (Web Image ist dort enthalten, in der CE nicht):

        JAVA_HOME=/pfad/zu/oracle-graalvm ./mvnw -Pwasm package

      Ergebnis: target/web/ — aendggner.js, aendggner.js.wasm und die statischen Seiten.
    -->
    <profile>
      <id>wasm</id>

      <properties>
        <native-image.executable>${java.home}/bin/native-image</native-image.executable>
        <wasm.output.directory>${project.build.directory}/web</wasm.output.directory>
        <!--
          Die Option „release 21“ beschränkte den Modulpfad auf die dokumentierte JDK-API; die
          Web-Image-API des GraalVM wäre damit unsichtbar. Deshalb hier source/target statt
          release — übersetzt wird ohnehin nur mit dem GraalVM, gegen dessen eigene Klassen.
        -->
        <maven.compiler.release/>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
      </properties>

      <dependencies>
        <!--
          Reines Java-zlib. Web Image bindet die nativen zlib-Funktionen des JDK nicht an
          (GR-65205); ohne Inflate ist kein PDF lesbar. Siehe
          src/wasm/java/.../InflaterErsatz.java.
        -->
        <dependency>
          <groupId>org.jruby</groupId>
          <artifactId>jzlib</artifactId>
          <version>${jzlib.version}</version>
        </dependency>
      </dependencies>

      <build>
        <plugins>

          <!-- Der Wasm-Quellbaum kommt nur in diesem Profil hinzu: Er braucht die
               Web-Image-API und svm.jar, die es nur im GraalVM gibt. -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>${build-helper-plugin.version}</version>
            <executions>
              <execution>
                <id>wasm-quellen</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/wasm/java</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <compilerArgs>
                <arg>--add-modules</arg>
                <arg>org.graalvm.webimage.api</arg>
              </compilerArgs>
              <!--
                Ohne Picocli-Annotationsprozessor: Er meldet die Befehlszeilenklasse
                eu.mulk.aendggner.AendGgner mit „allDeclaredMethods“ zur Reflexion an, und
                die Erreichbarkeitsanalyse zieht daraufhin die gesamte Befehlszeilenfassung
                samt Picocli und den Dateizugriffen ins Browser-Image, obwohl BrowserMain
                nichts davon anfasst. Im Browser gibt es keine Befehlszeile.
              -->
              <proc>none</proc>
              <annotationProcessorPaths/>
            </configuration>
          </plugin>

          <!--
            Ein vorangegangener gewöhnlicher Bau hat die Picocli-Konfiguration womöglich
            schon nach target/classes gelegt; native-image liest sie von dort auch dann,
            wenn dieser Bau sie nicht mehr erzeugt. Also fort damit, sonst hinge die
            Bildgröße davon ab, was vorher lief.
          -->
          <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>${clean-plugin.version}</version>
            <executions>
              <execution>
                <id>picocli-konfiguration-fort</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>clean</goal>
                </goals>
                <configuration>
                  <excludeDefaultDirectories>true</excludeDefaultDirectories>
                  <filesets>
                    <fileset>
                      <directory>
                        ${project.build.outputDirectory}/META-INF/native-image/picocli-generated
                      </directory>
                    </fileset>
                  </filesets>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>statische-seiten</id>
                <phase>package</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${wasm.output.directory}</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/main/resources/eu/mulk/aendggner/web</directory>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>web-image</id>
                <phase>package</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>${native-image.executable}</executable>
                  <arguments>
                    <argument>--tool:svm-wasm</argument>
                    <!-- Größe vor Durchsatz: Das Modul muss über die Leitung, und die
                         Rechenzeit einer Synopse liegt ohnehin im Sekundenbereich. -->
                    <argument>-Os</argument>
                    <!-- Der Textzwischenschritt (aendggner.js.wat) wird sonst mehrere hundert
                         Megabyte groß; auf die Größe des .wasm hat das keinen Einfluss. -->
                    <argument>-H:WasmComments=NONE</argument>
                    <argument>-classpath</argument>
                    <classpath/>
                    <argument>-o</argument>
                    <argument>${wasm.output.directory}/aendggner</argument>
                    <argument>eu.mulk.aendggner.wasm.BrowserMain</argument>
                  </arguments>
                </configuration>
              </execution>

              <!--
                Macht aus dem Übersetzerergebnis ein auslieferbares Verzeichnis: entfernt den
                .wat-Zwischenschritt, legt den Quelltext der gebauten Fassung bei (AGPLv3 §13)
                und komprimiert vor. Läuft in derselben Phase, aber nach „web-image“ — Maven
                führt gleichphasige Ausführungen in Deklarationsreihenfolge aus.
              -->
              <execution>
                <id>webpaket</id>
                <phase>package</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>${project.basedir}/deploy/webpaket.sh</executable>
                  <arguments>
                    <argument>${wasm.output.directory}</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>

  </profiles>

</project>