简体   繁体   中英

Retrieve most recent SNAPSHOT from different resolvers with sbt

I am writing an application using play 2.2.1 with sbt 0.13.0. In this application I have a dependency to another project which is a snapshot and to which I also make some modifications. If I build that project it is written to my local Maven repository. But normally that project should be retrieved from a private online Maven repository.

How can I configure sbt to always retrieve the newest version of the snapshot, regardless if it has to be retrieved from my local Maven repository or the online Maven repository.

Till now I added this to my build.sbt:

resolvers += "Online Repo" at "https://online-repo.com/somePath"
resolvers += "Local Maven Repository" at "file:///"+Path.userHome.absolutePath+"/.m2/" 
libraryDependencies += "com.some.project" % "a-project" % "2.0-SNAPSHOT"

The problem with this is that the project is retrieved from the first resolver. In this case "Online Repo". Although the Snapshot in "Local Maven Repository" could be newer.

How can I configure sbt to always retrieve the newest version of the snapshot, regardless if it has to be retrieved from my local Maven repository or the online Maven repository.

According to Dependency Management Flow :

update resolves dependencies according to the settings in a build file, such as libraryDependencies and resolvers.

and

Directly running the update task (as opposed to a task that depends on it) will force resolution to run, whether or not configuration changed. This should be done in order to refresh remote SNAPSHOT dependencies.

which means that SBT does this by design.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM