Skip to content

Instantly share code, notes, and snippets.

@tuxfight3r
Forked from vrischmann/.credentials
Created December 7, 2017 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuxfight3r/bc1b702ef3af23f48bdeafc532c01077 to your computer and use it in GitHub Desktop.
Save tuxfight3r/bc1b702ef3af23f48bdeafc532c01077 to your computer and use it in GitHub Desktop.
Running SBT with a Nexus proxy with authentication
realm=Sonatype Nexus Repository Manager
host=nexus.company.com
user=admin
password=admin123
export SBT_CREDENTIALS="$HOME/.ivy2/.credentials"
export SBT_OPTS="-Dsbt.override.build.repos=true -Dfile.encoding=UTF8 -Xms1024m -Xmx1024m -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m"

WARNING Not tested with the sbt script from the Debian package, if you use it be sure to check the .sbtconfig is correctly imported.

Instructions

  • Put .sbtconfig in $HOME/.sbtconfig
  • Put credentials.sbt in $HOME/.sbt/0.13/plugins/credentials.sbt
  • Put .credentials in $HOME/.ivy2/.credentials
  • Put repositoriesin $HOME/.sbt/repositories

Nexus configuration

On your Nexus instance, you need to create two "Repository Groups", one called ivy and one called maven. The ivy one should include these two repositories:

The maven one should include at least the Maven Central repository, already configured in Nexus by default. You can add in this group any other repository you want, like the Aapche Snapshots repository or whatever.

credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
[repositories]
local
my-ivy-proxy-releases: http://nexus.company.com/nexus/content/groups/ivy/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
my-maven-proxy-releases: http://nexus.company.com/nexus/content/groups/maven/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment