How to remove all default resolvers from a Play! application?
Turns out the answer is to use the correct sbt
syntax.
The code listed in the question is generating configuration for the build, but not assigning it anywhere. I believed the :=
replaced the global config for the resolvers
key, but it does not.
Putting the following in project/Build.scala
forced the Play app to resolve dependencies from our internal Nexus:
val nexusResolvers = resolvers := Seq(
"Maven Central (proxy)" at "http://repo-1/nexus/content/repositories/central/",
"Typesafe (proxy)" at "http://repo-1/nexus/content/repositories/typesafe-releases/",
// some more internal Nexus repositories
)
Note assigning the result of resolvers :=
to a new val, which is then added to the settings of the project in the same file:
val main = PlayProject(...)
.settings(nexusResolvers: _*)
Also, got rid of the sbtResolver
and externalResolvers
parts of the config, which had no effect.
Edit or create /home/YOUR_HOME/.sbt/repositories add the following:
[repositories]
local
my-maven-proxy-releases: http://nexus_domain_or_ip:8081/nexus/content/groups/public/
when running play add this parameter: -Dsbt.override.build.repos=true
e.g: activator run -Dsbt.override.build.repos=true
This prevents play from loading the repositories defined in project configs.
See this for details.