|
568 | 568 | </dependencies> |
569 | 569 |
|
570 | 570 | <build> |
| 571 | + <finalName>obp-api</finalName> |
571 | 572 | <plugins> |
572 | 573 | <plugin> |
573 | 574 | <groupId>org.apache.maven.plugins</groupId> |
|
586 | 587 | <forkMode>once</forkMode> |
587 | 588 | <junitxml>.</junitxml> |
588 | 589 | <filereports>WDF TestSuite.txt</filereports> |
589 | | - <!-- Keep this module list identical to the shaded-jar manifest's Add-Opens |
590 | | - (below, near maven-shade-plugin's ManifestResourceTransformer): a module |
| 590 | + <!-- Keep this module list identical to the thin-jar manifest's Add-Opens |
| 591 | + (below, near maven-jar-plugin's manifestEntries): a module |
591 | 592 | opened for the test JVM but not production (or vice versa) causes an |
592 | 593 | InaccessibleObjectException that only reproduces in whichever environment |
593 | 594 | is missing it. --> |
|
738 | 739 | <release>${java.version}</release> |
739 | 740 | </configuration> |
740 | 741 | </plugin> |
741 | | - <!-- maven-shade-plugin: Create executable fat JAR with all dependencies --> |
| 742 | + <!-- Thin JAR: project classes/resources only. Runnable via `java -jar` because the |
| 743 | + manifest carries Main-Class + Class-Path (relative lib/) + Add-Opens. |
| 744 | + JEP 261: the `java -jar` launcher honors Add-Opens from the manifest. |
| 745 | + Required on JDK 17+ for CGLib (StarConnector proxy generation via |
| 746 | + ClassLoader.defineClass), Kryo/chill serialization, Pekko remoting and |
| 747 | + Scala runtime reflection. development/docker/Dockerfile (local dev |
| 748 | + image) relies on this and launches with a plain `java -jar`. |
| 749 | + .github/Dockerfile_PreBuild (the production image) instead keeps its |
| 750 | + own explicit "add-opens" ENTRYPOINT flags — that is the combination |
| 751 | + actually verified against the K8s deployment, so don't remove it in |
| 752 | + favor of this manifest alone without re-verifying in that environment. |
| 753 | + Keep this module list identical to the scalatest-maven-plugin argLine |
| 754 | + above (surefire test JVM): a module opened here but not there (or vice |
| 755 | + versa) causes an InaccessibleObjectException that only reproduces in |
| 756 | + whichever environment is missing it. --> |
742 | 757 | <plugin> |
743 | 758 | <groupId>org.apache.maven.plugins</groupId> |
744 | | - <artifactId>maven-shade-plugin</artifactId> |
745 | | - <version>3.5.1</version> |
| 759 | + <artifactId>maven-jar-plugin</artifactId> |
| 760 | + <version>3.4.2</version> |
746 | 761 | <configuration> |
747 | | - <shadedArtifactAttached>false</shadedArtifactAttached> |
748 | | - <createDependencyReducedPom>false</createDependencyReducedPom> |
749 | | - <transformers> |
750 | | - <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> |
| 762 | + <archive> |
| 763 | + <manifest> |
751 | 764 | <mainClass>bootstrap.http4s.Http4sServer</mainClass> |
752 | | - <!-- JEP 261: the `java -jar` launcher honors Add-Opens from the manifest. |
753 | | - Required on JDK 17+ for CGLib (StarConnector proxy generation via |
754 | | - ClassLoader.defineClass), Kryo/chill serialization, Pekko remoting and |
755 | | - Scala runtime reflection. development/docker/Dockerfile (local dev |
756 | | - image) relies on this and launches with a plain `java -jar`. |
757 | | - .github/Dockerfile_PreBuild (the production image) instead keeps its |
758 | | - own explicit "add-opens" ENTRYPOINT flags — that is the combination |
759 | | - actually verified against the K8s deployment, so don't remove it in |
760 | | - favor of this manifest alone without re-verifying in that environment. |
761 | | - Keep this module list identical to the scalatest-maven-plugin argLine |
762 | | - above (surefire test JVM): a module opened here but not there (or vice |
763 | | - versa) causes an InaccessibleObjectException that only reproduces in |
764 | | - whichever environment is missing it. --> |
765 | | - <manifestEntries> |
766 | | - <Add-Opens>java.base/java.lang java.base/java.lang.reflect java.base/java.util java.base/java.lang.invoke java.base/java.util.jar java.base/sun.reflect.generics.reflectiveObjects java.base/java.io java.base/java.util.concurrent java.base/java.security</Add-Opens> |
767 | | - </manifestEntries> |
768 | | - </transformer> |
769 | | - <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> |
770 | | - <resource>reference.conf</resource> |
771 | | - </transformer> |
772 | | - </transformers> |
773 | | - <filters> |
774 | | - <filter> |
775 | | - <artifact>*:*</artifact> |
776 | | - <excludes> |
777 | | - <exclude>META-INF/*.SF</exclude> |
778 | | - <exclude>META-INF/*.DSA</exclude> |
779 | | - <exclude>META-INF/*.RSA</exclude> |
780 | | - </excludes> |
781 | | - </filter> |
782 | | - </filters> |
783 | | - <finalName>obp-api</finalName> |
| 765 | + <addClasspath>true</addClasspath> |
| 766 | + <classpathPrefix>lib/</classpathPrefix> |
| 767 | + </manifest> |
| 768 | + <manifestEntries> |
| 769 | + <Add-Opens>java.base/java.lang java.base/java.lang.reflect java.base/java.util java.base/java.lang.invoke java.base/java.util.jar java.base/sun.reflect.generics.reflectiveObjects java.base/java.io java.base/java.util.concurrent java.base/java.security</Add-Opens> |
| 770 | + </manifestEntries> |
| 771 | + </archive> |
784 | 772 | </configuration> |
| 773 | + </plugin> |
| 774 | + |
| 775 | + <!-- Copy runtime dependencies to target/lib/ (sibling of obp-api.jar) --> |
| 776 | + <plugin> |
| 777 | + <groupId>org.apache.maven.plugins</groupId> |
| 778 | + <artifactId>maven-dependency-plugin</artifactId> |
| 779 | + <version>3.8.1</version> |
785 | 780 | <executions> |
786 | 781 | <execution> |
787 | | - <id>make-fat-jar</id> |
788 | | - <phase>package</phase> |
| 782 | + <id>copy-runtime-deps</id> |
| 783 | + <phase>prepare-package</phase> |
789 | 784 | <goals> |
790 | | - <goal>shade</goal> |
| 785 | + <goal>copy-dependencies</goal> |
791 | 786 | </goals> |
| 787 | + <configuration> |
| 788 | + <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| 789 | + <includeScope>runtime</includeScope> |
| 790 | + <overWriteReleases>false</overWriteReleases> |
| 791 | + <overWriteSnapshots>true</overWriteSnapshots> |
| 792 | + </configuration> |
792 | 793 | </execution> |
793 | 794 | </executions> |
794 | 795 | </plugin> |
|
0 commit comments