Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell SBT to resolve managed artifacts

Is there a command in the SBT console that forces it to resolve artifacts (especially, re-resolve SNAPSHOT dependencies)? The only way I know of now is to run clean and then compile (or start), but this takes much longer and isn't always necessary.

like image 250
Manuel Bernhardt Avatar asked Apr 21 '12 16:04

Manuel Bernhardt


People also ask

How does SBT resolve dependencies?

Background. update resolves dependencies according to the settings in a build file, such as libraryDependencies and resolvers . Other tasks use the output of update (an UpdateReport ) to form various classpaths. Tasks that in turn use these classpaths, such as compile or run , thus indirectly depend on update .

Which is the correct way to add dependencies in SBT file?

If you have JAR files (unmanaged dependencies) that you want to use in your project, simply copy them to the lib folder in the root directory of your SBT project, and SBT will find them automatically.

Does SBT use ivy?

By default, sbt uses the standard Ivy home directory location ${user.

How do I clear my SBT cache?

You can use Pretty Clean to clean the all of dev tools caches including SBT. PrettyClean also cleans the SBT project's target folder.


2 Answers

You can mark the needed dependencies to re-check them on update:

libraryDependencies ++= {
  "org.specs2" %% "specs2" % "1.10-SNAPSHOT" % "test" changing()
}

Re-download a SNAPSHOT version of a dependency using SBT

like image 125
Rogach Avatar answered Oct 28 '22 16:10

Rogach


The update command should help.

From the task's documentation:

Resolves and optionally retrieves dependencies, producing a report.

See Dependency Management Flow.

What's more important, SNAPSHOT dependencies are in their nature changing() so there's no need to add anything after ModuleID to mark them as such. Every update is supposed to resolve them against the repositories.

like image 31
Jacek Laskowski Avatar answered Oct 28 '22 17:10

Jacek Laskowski