Sarath S Kumar Sarath S Kumar - 1 year ago 106
Scala Question

SBT Downloads or Resolves Jar each time when code is compiled

When I compile sbt-scala project, for each compilation the sbt is downloading or resolving jar even though the jar is available in

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
and all project will refer the dependency fromĀ 

Please tell me is there any way to stop this resolution or download when the jar is already available in

Answer Source

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)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download