Skip to content

Instantly share code, notes, and snippets.

@littlebox692
Forked from vrischmann/.credentials
Created September 3, 2017 02:49
Show Gist options
  • Save littlebox692/a89436fe196ef42fabeada30abc81748 to your computer and use it in GitHub Desktop.
Save littlebox692/a89436fe196ef42fabeada30abc81748 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