如何配置Typesafe Activator不使用用户主页?

enl*_*ait 9 sbt typesafe-activator

我想配置Typesafe Activator,它的捆绑工具不使用我的用户主目录 - 我的意思是~/.activator(配置?),~/.sbt(sbt配置?),特别是~/.ivy2我想在两个操作系统之间共享.Typesafe"文档"没什么帮助.

请帮助Windows和Linux.

Jac*_*ski 8

从sbt的官方文档中的命令行选项:

  • sbt.global.base-包含全局设置和插件目录(默认:~/.sbt/0.13)
  • sbt.ivy.home-包含本地常春藤库和工件高速缓存目录(默认:~/.ivy2)

它似乎~/.activator是在启动脚本中设置和使用的,这就是我要更改值的地方.

它也出现(在sbt/sbt.boot.propertiesactivator-launch-1.2.1.jar),该值ivy-home${user.home}/.ivy2:

[ivy]
  ivy-home: ${user.home}/.ivy2
  checksums: ${sbt.checksums-sha1,md5}
  override-build-repos: ${sbt.override.build.repos-false}
  repository-config: ${sbt.repository.config-${sbt.global.base-${user.home}/.sbt}/repositories}
Run Code Online (Sandbox Code Playgroud)

这意味着如果没有一些发展,它只能改变sbt.global.base.

?  minimal-scala  activator -Dsbt.global.base=./sbt -Dsbt.ivy.home=./ivy2 about
[info] Loading project definition from /Users/jacek/sandbox/sbt-launcher/minimal-scala/project
[info] Set current project to minimal-scala (in build file:/Users/jacek/sandbox/sbt-launcher/minimal-scala/)
[info] This is sbt 0.13.5
[info] The current project is {file:/Users/jacek/sandbox/sbt-launcher/minimal-scala/}minimal-scala 1.0
[info] The current project is built against Scala 2.11.1
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.4
Run Code Online (Sandbox Code Playgroud)

如果你想在引擎盖下看,可以查询主目录为SBT和常春藤与当前值consoleProject命令(它假设你开始activator使用activator -Dsbt.global.base=./sbt -Dsbt.ivy.home=./ivy2):

> consoleProject
[info] Starting scala interpreter...
[info]
import sbt._
import Keys._
import _root_.sbt.plugins.IvyPlugin
import _root_.sbt.plugins.JvmPlugin
import _root_.sbt.plugins.CorePlugin
import _root_.sbt.plugins.JUnitXmlReportPlugin
import currentState._
import extracted._
import cpHelpers._
Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_60).
Type in expressions to have them evaluated.
Type :help for more information.

scala> appConfiguration.eval.provider.scalaProvider.launcher.bootDirectory
res0: java.io.File = /Users/jacek/sandbox/sbt-launcher/minimal-scala/sbt/boot

scala> appConfiguration.eval.provider.scalaProvider.launcher.ivyHome
res1: java.io.File = /Users/jacek/.ivy2
Run Code Online (Sandbox Code Playgroud)

当且仅当你真正进入说服力激活使用sbt.ivy.home,你必须改变sbt/sbt.boot.propertiesactivator-launch-1.2.2.jar.请按照以下步骤操作:

  1. 解压缩sbt/sbt.boot.properties出来的activator-launch-1.2.2.jar.

    jar -xvf activator-launch-1.2.2.jar sbt/sbt.boot.properties
    
    Run Code Online (Sandbox Code Playgroud)
  2. 编辑sbt/sbt.boot.properties并替换ivy-home[ivy].

    ivy-home: ${sbt.ivy.home-${user.home}/.ivy2}
    
    Run Code Online (Sandbox Code Playgroud)
  3. 将更改添加sbt/sbt.boot.propertiesactivator-launch-1.2.2.jar.

    jar -uvf activator-launch-1.2.2.jar sbt/sbt.boot.properties
    
    Run Code Online (Sandbox Code Playgroud)

随着变化,-Dsbt.ivy.home=./ivy2工作正常.

scala> appConfiguration.eval.provider.scalaProvider.launcher.bootDirectory
res0: java.io.File = /Users/jacek/sandbox/sbt-launcher/minimal-scala/sbt/boot

scala> appConfiguration.eval.provider.scalaProvider.launcher.ivyHome
res1: java.io.File = /Users/jacek/sandbox/sbt-launcher/minimal-scala/ivy2
Run Code Online (Sandbox Code Playgroud)