Spring-boot: Include system scoped artifacts in repackage goal

Created on 23 Dec 2014  路  10Comments  路  Source: spring-projects/spring-boot

Currently only runtime, compile and provided are included in the final jar when repackaging for a runnable jar, given that provided are already being packaged it makes sense that system scoped artifacts can be included too.

The simplest workaround is setting a private maven repo but if you are using system scope usually you can not set up your own maven repo.

enhancement

Most helpful comment

There is an includeSystemScope that you can use to add system-scope dependencies to the fat jar.

All 10 comments

I don't think we should do this by default as it's possible that existing users are depending on this behavior. I've also seen system dependencies used quite often to refer to lib/tools.jar which we would definitely not want to package inside a "fat jar".

Perhaps a switch to enable it would be a nice enhancement.

I woudn't do that either. Maybe including it explicitly by adding an "include" in the plugin's configuration? @frisco82 would that work for you?

Having a configuration switch is perfect for me or even an list of artifact to include aside of the default ones.
I tried the includes configuration but it seems that it does not search for system scoped artifacts and indeed replaces the whole list of artifacts to include (or at least I was unable to make it work).

good point. The switch is probably the easiest solution.

Base on my understanding, the system scope defined by maven means it will be available in both compile & runtime.
So it's reasonable to support system scoped jar included in runtime lib via repackage.

Looking forward to this!

Usecase where I see this is with some wrapper libraries not available in maven - and CI server being operated centrally and not liking people adding stuff to repositories on their own, or running own repositories.

@xfcjscn that's actually not accurate: system is exactly like provided. Since Spring Boot embeds the actual process, we have a specific way of handling provided dependencies. From that perspective, it makes sense indeed to handle system scoped dependencies as well.

There is an includeSystemScope that you can use to add system-scope dependencies to the fat jar.

Nice work @snicoll !!

perfect!!! @snicoll

Was this page helpful?
0 / 5 - 0 ratings