|
1 | | -<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"> |
| 1 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 2 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
2 | 3 | <modelVersion>4.0.0</modelVersion> |
3 | 4 |
|
4 | 5 | <groupId>com.github.onoderis</groupId> |
|
10 | 11 |
|
11 | 12 | <properties> |
12 | 13 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
13 | | - <failchat.distribution.directory>${project.build.directory}/failchat-v${project.version} |
14 | | - </failchat.distribution.directory> |
| 14 | + |
| 15 | + <failchat.artifactName>${project.artifactId}-${project.version}</failchat.artifactName> |
15 | 16 |
|
16 | 17 | <maven.compiler.source>11</maven.compiler.source> |
17 | 18 | <maven.compiler.target>11</maven.compiler.target> |
|
40 | 41 | <wiremock.version>2.27.2</wiremock.version> |
41 | 42 | <kotest.version>4.3.2</kotest.version> |
42 | 43 | <mockk.version>1.10.5</mockk.version> |
| 44 | + |
| 45 | + <maven-resources-plugin.version>3.0.2</maven-resources-plugin.version> |
43 | 46 | </properties> |
44 | 47 |
|
45 | 48 |
|
|
320 | 323 |
|
321 | 324 | <plugin> |
322 | 325 | <artifactId>maven-resources-plugin</artifactId> |
323 | | - <version>3.0.2</version> |
| 326 | + <version>${maven-resources-plugin.version}</version> |
324 | 327 | <executions> |
325 | 328 | <execution> |
326 | 329 | <id>default-resources</id> |
|
336 | 339 | <resources> |
337 | 340 | <resource> |
338 | 341 | <directory>${basedir}/src/main/resources</directory> |
339 | | - <filtering>true</filtering> |
340 | 342 | </resource> |
341 | 343 | <resource> |
342 | 344 | <directory>${basedir}/src/main/external-resources</directory> |
|
349 | 351 | </configuration> |
350 | 352 | </execution> |
351 | 353 |
|
| 354 | + <execution> |
| 355 | + <id>copy-test-config</id> |
| 356 | + <phase>generate-test-resources</phase> |
| 357 | + <goals> |
| 358 | + <goal>testResources</goal> |
| 359 | + </goals> |
| 360 | + <configuration> |
| 361 | + <outputDirectory>${basedir}/target/test-classes/config</outputDirectory> |
| 362 | + <resources> |
| 363 | + <resource> |
| 364 | + <directory>${basedir}/src/main/resources/config</directory> |
| 365 | + </resource> |
| 366 | + </resources> |
| 367 | + </configuration> |
| 368 | + </execution> |
| 369 | + |
352 | 370 | <execution> |
353 | 371 | <id>copy-resources-on-package</id> |
354 | 372 | <phase>prepare-package</phase> |
355 | 373 | <goals> |
356 | 374 | <goal>copy-resources</goal> |
357 | 375 | </goals> |
358 | 376 | <configuration> |
359 | | - <outputDirectory>${failchat.distribution.directory}</outputDirectory> |
| 377 | + <outputDirectory>${project.build.directory}/${failchat.artifactName}</outputDirectory> |
360 | 378 | <resources> |
361 | 379 | <resource> |
362 | 380 | <directory>${basedir}/src/main/external-resources</directory> |
|
368 | 386 | </excludes> |
369 | 387 | </resource> |
370 | 388 | <resource> |
371 | | - <!-- .bat/.sh files with filtering --> |
| 389 | + <!-- copy .bat/.sh and replace version placeholder --> |
372 | 390 | <directory>${basedir}/src/main/external-resources</directory> |
373 | 391 | <filtering>true</filtering> |
374 | 392 | <includes> |
|
379 | 397 | </resources> |
380 | 398 | </configuration> |
381 | 399 | </execution> |
382 | | - |
383 | | - <execution> |
384 | | - <id>copy-test-config</id> |
385 | | - <phase>generate-test-resources</phase> |
386 | | - <goals> |
387 | | - <goal>testResources</goal> |
388 | | - </goals> |
389 | | - <configuration> |
390 | | - <outputDirectory>${basedir}/target/test-classes/config</outputDirectory> |
391 | | - <resources> |
392 | | - <resource> |
393 | | - <directory>${basedir}/src/main/resources/config</directory> |
394 | | - </resource> |
395 | | - </resources> |
396 | | - </configuration> |
397 | | - </execution> |
398 | 400 | </executions> |
399 | 401 | </plugin> |
400 | 402 |
|
| 403 | + <!-- maven-shade-plugin requires base artifact to generate uber jar--> |
401 | 404 | <plugin> |
402 | 405 | <groupId>org.apache.maven.plugins</groupId> |
403 | 406 | <artifactId>maven-jar-plugin</artifactId> |
404 | | - <version>3.0.2</version> |
| 407 | + <version>3.4.2</version> |
405 | 408 | <configuration> |
406 | | - <finalName>failchat-${project.version}</finalName> |
407 | | - <outputDirectory>${failchat.distribution.directory}</outputDirectory> |
| 409 | + <finalName>${failchat.artifactName}</finalName> |
| 410 | + <outputDirectory>${project.build.directory}/${failchat.artifactName}</outputDirectory> |
408 | 411 | <archive> |
409 | 412 | <manifest> |
410 | 413 | <mainClass>failchat.FailchatMainKt</mainClass> |
|
423 | 426 | <plugin> |
424 | 427 | <groupId>org.apache.maven.plugins</groupId> |
425 | 428 | <artifactId>maven-shade-plugin</artifactId> |
426 | | - <version>3.2.4</version> |
| 429 | + <version>3.6.0</version> |
427 | 430 | <executions> |
428 | 431 | <execution> |
| 432 | + <id>uber-jar</id> |
429 | 433 | <phase>package</phase> |
430 | 434 | <goals> |
431 | 435 | <goal>shade</goal> |
432 | 436 | </goals> |
433 | 437 | <configuration> |
| 438 | + <createDependencyReducedPom>false</createDependencyReducedPom> |
434 | 439 | <transformers> |
435 | | - <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" /> |
436 | | - <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer" /> |
437 | | - <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> |
| 440 | + <transformer |
| 441 | + implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/> |
| 442 | + <transformer |
| 443 | + implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/> |
| 444 | + <transformer |
| 445 | + implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> |
438 | 446 | <manifestEntries> |
439 | 447 | <Main-Class>failchat.FailchatMainKt</Main-Class> |
440 | 448 | </manifestEntries> |
441 | 449 | </transformer> |
442 | | - <transformer implementation="org.apache.maven.plugins.shade.resource.properties.PropertiesTransformer"> |
| 450 | + <transformer |
| 451 | + implementation="org.apache.maven.plugins.shade.resource.properties.PropertiesTransformer"> |
443 | 452 | <resource>META-INF/io.netty.versions.properties</resource> |
444 | 453 | <ordinalKey>ordinal</ordinalKey> |
445 | 454 | </transformer> |
|
459 | 468 | </excludes> |
460 | 469 | </filter> |
461 | 470 | </filters> |
462 | | - <createDependencyReducedPom>false</createDependencyReducedPom> |
463 | 471 | </configuration> |
464 | 472 | </execution> |
465 | 473 | </executions> |
|
479 | 487 | <excludeDefaultDirectories>true</excludeDefaultDirectories> |
480 | 488 | <filesets> |
481 | 489 | <fileset> |
482 | | - <directory>${failchat.distribution.directory}/runtime</directory> |
| 490 | + <directory>${project.build.directory}/runtime-windows</directory> |
| 491 | + <directory>${project.build.directory}/runtime-linux</directory> |
483 | 492 | </fileset> |
484 | 493 | </filesets> |
485 | 494 | </configuration> |
|
490 | 499 | <plugin> |
491 | 500 | <groupId>org.codehaus.mojo</groupId> |
492 | 501 | <artifactId>exec-maven-plugin</artifactId> |
493 | | - <version>3.0.0</version> |
| 502 | + <version>3.5.0</version> |
494 | 503 | <executions> |
495 | 504 | <execution> |
496 | | - <id>build-app-runtime</id> |
| 505 | + <id>build-windows-runtime</id> |
497 | 506 | <phase>package</phase> |
498 | 507 | <goals> |
499 | 508 | <goal>exec</goal> |
|
511 | 520 | java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.management,java.naming,java.sql,java.xml,javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.web,jdk.attach,jdk.jdi,jdk.jsobject,jdk.unsupported,jdk.crypto.ec |
512 | 521 | </argument> |
513 | 522 | <!-- use specific jdk to build an app runtime. this is required to compile across different OS --> |
514 | | - <!-- comment the next 2 lines to build with a jdk in PATH--> |
515 | 523 | <argument>--module-path</argument> |
516 | 524 | <argument>jdk/bellsoft-jdk11.0.22+12-windows-amd64-full/jmods</argument> |
517 | 525 | <argument>--output</argument> |
518 | | - <argument>${failchat.distribution.directory}/runtime</argument> |
| 526 | + <argument>${project.build.directory}/${failchat.artifactName}/runtime-windows</argument> |
| 527 | + </arguments> |
| 528 | + </configuration> |
| 529 | + </execution> |
| 530 | + <execution> |
| 531 | + <id>build-linux-runtime</id> |
| 532 | + <phase>package</phase> |
| 533 | + <goals> |
| 534 | + <goal>exec</goal> |
| 535 | + </goals> |
| 536 | + <configuration> |
| 537 | + <executable>jlink</executable> |
| 538 | + <arguments> |
| 539 | + <argument>--no-header-files</argument> |
| 540 | + <argument>--no-man-pages</argument> |
| 541 | + <argument>--compress=2</argument> |
| 542 | + <argument>--strip-debug</argument> |
| 543 | + <argument>--add-modules</argument> |
| 544 | + <!-- TODO dynamically generate the list of modules --> |
| 545 | + <argument> |
| 546 | + java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.management,java.naming,java.sql,java.xml,javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.web,jdk.attach,jdk.jdi,jdk.jsobject,jdk.unsupported,jdk.crypto.ec |
| 547 | + </argument> |
| 548 | + <!-- use specific jdk to build an app runtime. this is required to compile across different OS --> |
| 549 | + <argument>--module-path</argument> |
| 550 | + <argument>jdk/bellsoft-jdk11.0.22+12-linux-amd64-full/jmods</argument> |
| 551 | + <argument>--output</argument> |
| 552 | + <argument>${project.build.directory}/${failchat.artifactName}/runtime-linux</argument> |
519 | 553 | </arguments> |
520 | 554 | </configuration> |
521 | 555 | </execution> |
|
529 | 563 | <executable>java</executable> |
530 | 564 | <arguments> |
531 | 565 | <argument>-classpath</argument> |
532 | | - <classpath /> |
| 566 | + <classpath/> |
533 | 567 | <argument>failchat.FailchatMainKt</argument> |
534 | 568 | <argument>--skip-release-check</argument> |
535 | 569 | <argument>--enable-console-logging</argument> |
|
546 | 580 |
|
547 | 581 | <plugin> |
548 | 582 | <artifactId>maven-assembly-plugin</artifactId> |
549 | | - <version>3.0.0</version> |
| 583 | + <version>3.7.1</version> |
550 | 584 | <executions> |
551 | 585 | <execution> |
552 | | - <id>zip</id> |
| 586 | + <id>distribution-windows</id> |
553 | 587 | <phase>package</phase> |
554 | 588 | <goals> |
555 | 589 | <goal>single</goal> |
556 | 590 | </goals> |
557 | 591 | <configuration> |
558 | | - <finalName>failchat-v${project.version}</finalName> |
| 592 | + <finalName>${failchat.artifactName}-windows</finalName> |
559 | 593 | <appendAssemblyId>false</appendAssemblyId> |
560 | 594 | <archiverConfig> |
561 | 595 | <compress>true</compress> |
562 | 596 | </archiverConfig> |
563 | 597 | <descriptors> |
564 | | - <descriptor>src/main/assembly/zip.xml</descriptor> |
| 598 | + <descriptor>src/main/assembly/distribution-windows.xml</descriptor> |
| 599 | + </descriptors> |
| 600 | + </configuration> |
| 601 | + </execution> |
| 602 | + <execution> |
| 603 | + <id>distribution-linux</id> |
| 604 | + <phase>package</phase> |
| 605 | + <goals> |
| 606 | + <goal>single</goal> |
| 607 | + </goals> |
| 608 | + <configuration> |
| 609 | + <finalName>${failchat.artifactName}-linux</finalName> |
| 610 | + <appendAssemblyId>false</appendAssemblyId> |
| 611 | + <descriptors> |
| 612 | + <descriptor>src/main/assembly/distribution-linux.xml</descriptor> |
565 | 613 | </descriptors> |
566 | 614 | </configuration> |
567 | 615 | </execution> |
|
0 commit comments