好玩的大数据之20:Sbt安装(Sbt-1.3.13)

一、简介


sbt是类似ANT、MAVEN的构建工具,全称为Simple build tool,是Scala事实上的标准构建工具。

主要特性:

原生支持编译Scala代码和与诸多Scala测试框架进行交互;

使用Scala编写的DSL(领域特定语言)构建描述

使用Ivy作为库管理工具

持续编译、测试和部署

整合scala解释器快速迭代和调试

支持Java与Scala混合的项目

二、下载


        下载地址:https://www.scala-sbt.org/download.html

三、安装


    解压缩

        tar xvf sbt-1.3.13.tgz -C /mylab/soft

        会自动生成sbt目录

    改名

        mv /mylab/softsbt /mylab/softsbt-1.3.13

四、配置


    1.配置环境变量

            vi ~/.bashrc

#sbt-1.3.13

export SBT_HOME=$MYLAB_BASE_HOME/sbt-1.3.13

export PATH=$SBT_HOME/bin:$PATH

    2.增加国内maven源

在~/.sbt目录下,新建或修改repositories文件

vi ~/.sbt/repositories

[repositories]

local

aliyun-publice:http://maven.aliyun.com/nexus/content/groups/public

aliyun-central:http://maven.aliyun.com/nexus/content/repositories/central

huaweicloud-maven:https://repo.huaweicloud.com/repository/maven/

maven-central:https://repo.maven.apache.org/maven2

maven-repo1: http://repo1.maven.org/maven2

maven-repo2:http://repo2.maven.org/maven2

sonatype:http://www.sonatype.org/nexus/

mvnrepository:http://mvnrepository.com

typesafe:http://repo.typesafe.com/typesafe/ivy-releases/,[organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext],bootOnly

sbt-plugin-repo: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]

sonatype-oss-releases

sonatype-oss-snapshots

注:这些地址都是从网上摘取的,需要不断尝试

五、验证 


sbt -h

Usage: sbt [options]

  -h | --help        print this message

  -v | --verbose      this runner is chattier

  -V | --version      print sbt version information

  --numeric-version  print the numeric sbt version (sbt sbtVersion)

  --script-version    print the version of sbt script

  -d | --debug        set sbt log level to debug

  -debug-inc | --debug-inc

                      enable extra debugging for the incremental debugger

  --no-colors        disable ANSI color codes

  --color=auto|always|true|false|never

                      enable or disable ANSI color codes      (sbt 1.3 and above)

  --supershell=auto|always|true|false|never

                      enable or disable supershell            (sbt 1.3 and above)

  --traces            generate Trace Event report on shutdown (sbt 1.3 and above)

  --timings          display task timings report on shutdown

  --sbt-create        start sbt even if current directory contains no sbt project

  --sbt-dir    path to global settings/plugins directory (default: ~/.sbt)

  --sbt-boot    path to shared boot directory (default: ~/.sbt/boot in 0.11 series)

  --ivy        path to local Ivy repository (default: ~/.ivy2)

  --mem      set memory options (default: 1024)

  --no-share          use all local caches; no sharing

  --no-global        uses global caches, but does not use global ~/.sbt directory.

  --jvm-debug   Turn on JVM debugging, open at the given port.

  --batch            disable interactive mode

  # sbt version (default: from project/build.properties if present, else latest release)

  --sbt-version    use the specified version of sbt

  --sbt-jar            use the specified jar as the sbt launcher

  # java version (default: java from PATH, currently java version "1.8.0_251")

  --java-home         alternate JAVA_HOME

  # jvm options and output control

  JAVA_OPTS          environment variable, if unset uses "-Dfile.encoding=UTF-8"

  .jvmopts            if this file exists in the current directory, its contents

                      are appended to JAVA_OPTS

  SBT_OPTS            environment variable, if unset uses ""

  .sbtopts            if this file exists in the current directory, its contents

                      are prepended to the runner args

  /etc/sbt/sbtopts    if this file exists, it is prepended to the runner args

  -Dkey=val          pass -Dkey=val directly to the java runtime

  -J-X                pass option -X directly to the java runtime

                      (-J is stripped)

  -S-X                add -X to sbt's scalacOptions (-S is stripped)

In the case of duplicated or conflicting options, the order above

shows precedence: JAVA_OPTS lowest, command line options highest.

你可能感兴趣的:(好玩的大数据之20:Sbt安装(Sbt-1.3.13))