SBT changes the default Ivy warehouse location

Source: Internet
Author: User
Tags md5 sha1 sonatype

Transferred from: http://www.ituring.com.cn/article/132055


There is a write on the document:
Http://www.scala-sbt.org/0.13/docs/Launcher-Configuration.html

The first thought was to configure the file under Conf sbt/0.13/conf/sbtopts

# Path to local Ivy repository (default: ~/.ivy2)
#
-ivy H:/repository/jar    

However, after the configuration is not valid, SBT starts to download the jar is still placed in the ~/.ivy2
The final discovery document in the configuration file is in the Sbt\0.13\bin\sbt-launch.jar in the \sbt\sbt.boot.properties (RAR decompression tool can be opened directly to modify and overwrite), modified content as follows:

    [Scala] Version: ${sbt.scala.version-auto} [app] org: ${SBT.ORGANIZATION-ORG.SCALA-SBT} name:s BT version: ${sbt.version-read (sbt.version) [0.13.7]} class: ${sbt.main.class-sbt.xmain} COMPONENTS:XSBT
      I,extra cross-versioned: ${sbt.cross.versioned-false} resources: ${sbt.extraclasspath-} [repositories] Local Oschina Nexus:http://maven.oschina.net/content/groups/public/typesafe-ivy-releases:https://repo.ty Pesafe.com/typesafe/ivy-releases/, [Organization]/[module]/[revision]/[type]s/[artifact] (-[classifier]). [ext], bootonly maven-central sbt-plugins-repo:http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [orga nization]/[module]/(scala_[scalaversion]/) (sbt_[sbtversion]/) [Revision]/[type]s/[artifact] (-[classifier]). [Ext] Play:http://private-repo.typesafe.com/typesafe/maven-releases/sonatype-snapshots:https://oss.sonatype . org/content/repositories/snapshots [Boot] DireCtory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/} [Ivy] Ivy-home:h:\repository\jar checksums: ${sbt.checksums-sha1,md5} override-build-repos: ${sbt.override.build.repos-false} repository-confi   G: ${sbt.repository.config-${sbt.global.base-${user.home}/.sbt}/repositories}

You can also add parameter designations after the start command by modifying the Sbt.bat (Win) mode.

However, it is surprising that the first modification does not affect the location of the warehouse, but the note does not write this parameter as the warehouse location. Maybe I understand wrong.



Extract the Sbt-launch.jar and see what's causing it. There is a compiled class file in the jar package, where there is a sbt.boot.properties file in the SBT directory, which is what we need to modify, first look at the next section of the configuration information:

[Repositories]
  Local
  typesafe-ivy-releases:https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[ Revision]/[type]s/[artifact] (-[classifier]). [ext], bootonly
  maven-central

[boot]
  directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/ . sbt}/boot/}

[Ivy]
  ivy-home: ${sbt.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}

Repositories is the remote repository address, boot is set. SBT directory, ivy settings. Ivy2 Warehouse Directory, finally there is a repository-config, we can create a new repositories file under the modified SBT directory, Fill in the fast-access warehouse address, overwriting the default repositories setting information. In addition sbt.boot.directory,sbt.ivy.home,sbt.repository.config these are configurable parameter information, equivalent to not modify the configuration file, set parameters on the line, but I set in the idea of the time does not work, Please let us know by using-dsbt.boot.directory=/xxx/xxx, who knows how to set this way. The last modification is as follows:

[Repositories]
  Local
  typesafe-ivy-releases:https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[ Revision]/[type]s/[artifact] (-[classifier]). [ext], bootonly
  maven-central


[boot]
  directory:/users/zhujiajun/work/sbt/boot

[Ivy]
  Ivy-home:/users/zhujiajun/work/ivy-

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.