Reputation: 123
When I compile sbt-scala project, for each compilation the sbt is downloading or resolving jar even though the jar is available in .ivy2
cache and it's taking a huge time for assembly.
When I use Maven, Dependency resolution is done once and the component will never try to download the same dependency if exist in .M2
and all project will refer the dependency from .M2
directly
Please tell me is there any way to stop this resolution or download when the jar is already available in .ivy2
cache.
Upvotes: 0
Views: 1148
Reputation: 1066
You can sbt set to work offline:
When offline := true, remote SNAPSHOTs will not be updated by a resolution, even an explicitly requested update. This should effectively support working without a connection to remote repositories. Reproducible examples demonstrating otherwise are appreciated. Obviously, update must have successfully run before going offline.
quote from docs
If you can skip the update phase. Form the sbt shell:
set skip in update := true
If you want to use just the cached artifact add to your build.sbt
updateOptions := updateOptions.value.withCachedResolution(true)
My personal preference is to override default repos and add my local maven repo ( so resolution happens but is blazing fast)
Someone has gone really far with this problem setting up a huge stack ( interesting but not suggested)
Upvotes: 3