Switch to maven-dependency-plugin and adjust build output

Replaced `maven-shade-plugin` with `maven-dependency-plugin` for dependency management, simplifying the build process and separating runtime dependencies into a dedicated `lib/` directory. Updated `Dockerfile` and GitHub Actions config to account for these changes, ensuring all dependencies are correctly packaged and deployed.
This commit is contained in:
anthorob committed 2026-10-18 02:10:38 -04:00
1 parent dad2e0356e
commit 01bf94c60a
3 files changed
+13 -42

No files matched your search

+1
View File
@@ -50,6 +50,7 @@ jobs:
name: maven-artifacts name: maven-artifacts
path: | path: |
target/netneutrality.jar target/netneutrality.jar
target/lib
startup.sh startup.sh
if-no-files-found: error if-no-files-found: error
+1
View File
@@ -19,6 +19,7 @@ ARG API_PORT=9000
EXPOSE ${API_PORT} EXPOSE ${API_PORT}
COPY startup.sh ./ COPY startup.sh ./
COPY --from=build /build/target/lib ./lib
COPY --from=build /build/target/netneutrality.jar ./ COPY --from=build /build/target/netneutrality.jar ./
RUN ["chmod", "+x", "./startup.sh"] RUN ["chmod", "+x", "./startup.sh"]
+11 -42
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?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" <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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -87,9 +87,12 @@
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version> <version>3.5.0</version>
<configuration> <configuration>
<finalName>netneutrality</finalName>
<archive> <archive>
<manifest> <manifest>
<mainClass>${main.class}</mainClass> <mainClass>${main.class}</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest> </manifest>
</archive> </archive>
</configuration> </configuration>
@@ -97,52 +100,18 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<version>3.6.2</version> <version>3.8.1</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <id>copy-libs</id>
<phase>prepare-package</phase>
<goals> <goals>
<goal>shade</goal> <goal>copy-dependencies</goal>
</goals> </goals>
<configuration> <configuration>
<finalName>netneutrality</finalName> <outputDirectory>${project.build.directory}/lib</outputDirectory>
<filters> <includeScope>runtime</includeScope>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>module-info.class</exclude>
<exclude>META-INF/versions/*/module-info.class</exclude>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/LICENSE*</exclude>
<exclude>META-INF/NOTICE*</exclude>
<exclude>META-INF/DEPENDENCIES</exclude>
<exclude>META-INF/jandex.idx</exclude>
<exclude>META-INF/versions/9/OSGI-INF/MANIFEST.MF</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
<filter>
<artifact>com.squareup.okhttp3:okhttp</artifact>
<excludes>
<exclude>**</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${main.class}</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</transformer>
</transformers>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>