プロキシ環境でsbtを使う

sbtをプロキシ環境で使う方法

JAVA_OPTSにプロキシの設定を行うことでプロキシ環境でも使えるようになりました

export JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=<host> -Dhttp.proxyPort=<port> -Dhttp.proxyUser=<username> -Dhttp.proxyPassword=<password> -Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port> -Dhttps.proxyUser=<username> -Dhttps.proxyPassword=<password> -Dhttps.nonProxyHosts=localhost|127.0.0.1"

効果がなかった方法

  • sbtopts に設定
cat <<- EOS | sudo tee -a $(dirname $(readlink $(which sbt)))/../conf/sbtopts
    # proxy options
    -Dhttp.proxyHost=<host>
    -Dhttp.proxyPort=<port>
    -Dhttps.proxyHost=<host>
    -Dhttps.proxyPort=<port>
    -Dhttp.proxyUser=<username>
    -Dhttp.proxyPassword=<password>
    -Dhttps.proxyUser=<username>
    -Dhttps.proxyPassword=<password>
EOS
  • 起動オプションに追加
java -Xms1024m -Xmx1024m -XX:ReservedCodeCacheSize=256m  -XX:MaxMetaspaceSize=256m -
jar /usr/share/sbt/bin/sbt-launch.jar -debug -DproxySet=true -Dhttp.proxyHost=<host> -Dhttp.proxyPort=<port> -Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port> -Dhttp.proxyUser=<username> -Dhttp.proxyPassword=<password> -Dhttps.proxyUser=<username> -Dhttps.proxyPassword=<password>
  • TLSv1.2
-Dhttps.protocols=TLSv1.2 

ついでに   
-Dsbt.repository.secure=false    
-Dsbt.override.build.repos=true