DEV Community


Building 3rd party JARs in Spring (Maven project)

wakeupmh profile image Marcos Henrique ・1 min read

I had an external .jar that cannot be imported from public repositories using pom.xml, it's XPTO.jar.

I was able to run the project locally from my IDE and everything worked perfectly. Refer to the library after downloading it as follows:


When I run mvn clean package to create my .jar file and try to run the created .jar, an error will pop up.

I was facing this error and about getting crazy before finding this solution.

Miracle Solution 🙆‍♂️🙆‍♀️

In your pom.xml just add this <includeSystemScope>true</includeSystemScope> like this


The IDE can easily see the scope of the system by default, however when generating our build we have to force the maven to see this same scope.


Editor guide
khmarbaise profile image
Karl Heinz Marbaise

The last sentence is not accurate. You are forcing the spring-boot-maven-plugin to consider system scoped dependencies not Maven itself. Apart from that the usage of <scope>system</scope> will produce a WARNING during the build (since