Nikhil Vyas

Developer, Gamer. Python, C++, Rimworld

Maven - Bundle local JAR dependency within the target JAR

20 Mar 2019 » technology, others

Say you have two projects - ProjectX - which depends on ProjectY which is a local JAR. ProjectY is added as a dependency to ProjectX like this:


Now if you want a self-sufficient JAR with all the dependencies bundled, you’d probably use the maven-assembly-plugin like this


This would bundle all the dependencies, except the ones with a system scope - your local JARs.

To work around this issue, just install the JAR in the local maven repository and use it normally (without system scope / systemPath).

mvn install:install-file -Dfile=ProjectY.jar -DpomFile=../pom.xml

(Based on my unanswered question on StackOverflow) 😅