How to change the location of .activator.sbt.ivy folders in Play 2.3?

I just started learning Play Framework 2.3.0 and trying to move

  • .activator
  • .sbt
  • .ivy

from the %USERPROFILE% folder to a user folder like C:/learning/playframework/ on my Windows 7 machine. I want them to be portable / not lost during OS installation.

I changed sbt.boot.properties and changed user.home to a user location and passed play.home to activator.bat as a parameter.

Although the .sbt and .ivy initially created in the user folder when I try to create a new HelloWorld application, all these folders are created again in the %USERPROFILE% user directory and all files are uploaded there. .activator never created in the user folder and is always created in the %USERPROFILE% folder.

I also made sure that there were no spaces in the paths.

sbt.boot.properties:

 [app] org: com.typesafe.activator name: activator-launcher version: ${activator.version-read(activator.version)[1.2.1]} class: activator.ActivatorLauncher cross-versioned: false components: xsbti [repositories] local activator-local: file://${activator.local.repository-${activator.home-${play.home}/.activator}/repository}, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext] maven-central typesafe-releases: http://repo.typesafe.com/typesafe/releases typesafe-ivy-releasez: http://repo.typesafe.com/typesafe/ivy-releases, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext] [boot] directory: ${sbt.boot.directory-${sbt.global.base-${play.home}/.sbt}/boot/} properties: ${activator.boot.properties-${play.home}/.activator/version-${activator.launcher.generation-0}.properties} [ivy] ivy-home: ${play.home}/.ivy2 checksums: ${sbt.checksums-sha1,md5} override-build-repos: ${sbt.override.build.repos-false} repository-config: ${sbt.repository.config-${sbt.global.base-${play.home}/.sbt}/repositories} 

Please inform on setting up the Activator / Play Framework so that: 3 directories and a repository are created in the user directory, for example C:/learning/playframework/ .

+8
playframework sbt typesafe-activator
source share
2 answers

. The activator is never created in the user folder and always created in the% USERPROFILE% folder.

I understand that ~/.activator controlled by running a script where you must point to a user directory.

For ~/.sbt you really should use the sbt.global.base property, as I see it is used in the sbt code itself.

If you want to see under the hood, you can query the current home directory values ​​for sbt and Ivy using the consoleProject (assuming you started the activator with 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 

Iff, you really convince Activator to use sbt.ivy.home , you need to change sbt/sbt.boot.properties to activator-launch-1.2.2.jar . Just follow these steps:

  • Unzip sbt/sbt.boot.properties from activator-launch-1.2.2.jar .

     jar -xvf activator-launch-1.2.2.jar sbt/sbt.boot.properties 
  • Change sbt/sbt.boot.properties and replace ivy-home with [ivy] .

     ivy-home: ${sbt.ivy.home-${user.home}/.ivy2} 
  • Add the modified sbt/sbt.boot.properties to activator-launch-1.2.2.jar .

     jar -uvf activator-launch-1.2.2.jar sbt/sbt.boot.properties 

When changed, -Dsbt.ivy.home=./ivy2 works fine.

 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 
+4
source share

Just add activatorconfig.txt file %USERPROFILE%/.activator/ Place the following content in this file:

 -Dactivator.local.repository=C:\learning\playframework\repository -Dactivator.home=C:\learning\playframework\ -Dsbt.ivy.home=C:\learning\playframework\repository -Duser.home=C:\learning\playframework\ -Divy-home=C:\learning\playframework\repository 
+2
source share

All Articles