How can I skip retrieving dependencies in the provided scope when retrieveManaged is true?
After a few days of searching, I found an sbt plugin that suits my requirement perfectly. https://github.com/xerial/sbt-pack .
While it's not about lib_managed, it fetches all dependencies in target / pack / lib without the ones provided. And target / pack can be distributed directly without useless cans. This is exactly what I need.
source to share
The purpose of the module configuration provided
:
This is similar to compilation, but indicates that you expect the JDK or container to provide a runtime dependency. For example, when building a web application for Java Enterprise Edition, you must set a dependency on the Servlet API and its associated Java EE APIs for scope because the web container exposes these classes. This scope is only available on the compile and test path and is not transitive.
From the Maven docs (SBT uses Ivy, which in this case reuses Maven conventions).
The goal retrieveManaged := true
is as follows:
isolate your assemblies from flush ivy cache
From SBT Frequently Asked Questions
As such, I would say that it makes sense that dependencies provided
are still persisted down to lib_managed
under retrieveManaged := true
.
You might want to look at sbt-assembly as a way to bundle your application (including relationships provided
) instead of using retrieveManaged
.
source to share