teverett / ktelnet

A java telnet server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pushed artifact jar contains dependencies

ocervinka opened this issue · comments

The Maven build seems to be configured to create and publish fat jar which includes classes from all dependencies (logback, apache.commons.cli, slf4j). Flat jar is handy when running the Telnet server directly from the jar as no extra dependencies needs to be added to classpath. However, it causes problems when using the Telnet server as a library. Can we publish a jar with compiled classes only?

maven-shade-plugin is responsible for the fat jar.
When running mvn package it logs

[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing .../ktelnet/target/ktelnet-1.3.0-SNAPSHOT.jar with .../ktelnet/target/ktelnet-1.3.0-SNAPSHOT-shaded.jar

and produces

ktelnet-1.3.0-SNAPSHOT.jar 1MB
ktelnet-1.3.0-SNAPSHOT-shaded.jar 74kB

Removing the plugin from pom.xml fixed my issue. However, someone else might need the fat jar. If so, we can probably keep building both jars and publish only the plain one but I'm not familiar enough with Maven to do so.