文档章节

Docker内Sbt安装

 流氓兔来啦
发布于 2017/05/16 14:59
字数 1003
阅读 11
收藏 0

安装 准备安装1.0

  1. 官网安装方式 ubuntu和其他debian的发行版
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt
  1. 手动安装 Sbt-launch.jar 地址 https://repo1.maven.org/maven2/org/scala-sbt/sbt-launch/1.0.0-M4/sbt-launch.jar 手动安装需要下载 sbt-launch.jar,然后创建脚本来运行它。 Unix

将 sbt-launch.jar 文件放在 ~/bin 下。 创建一个脚本来运行这个 jar,脚本 ~/bin/sbt 内容如下:

#!/bin/bash
SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jar `路径名 $0`sbt-launch.jar "$@"  (官网sbt-lanunch.jar前有斜杠,但是出现错误,所以给去掉了)

给该脚本赋予可执行权限:

$ chmod u+x ~/bin/sbt 结果:

root@master:/usr/local/sbt# vim sbt
root@master:/usr/local/sbt# ./sbt
./sbt: line 3: /usr/local/sbt/: Is a directory
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
Getting org.scala-sbt sbt 1.0.0-M4 ...
downloading https://repo1.maven.org/maven2/org/scala-sbt/sbt/1.0.0-M4/sbt-1.0.0-M4.jar ...
	[SUCCESSFUL ] org.scala-sbt#sbt;1.0.0-M4!sbt.jar (1088ms)
 

root@master:/usr/local/sbt# sbt version
/usr/local/sbt/sbt: line 3: /usr/local/sbt/: Is a directory
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
[info] Set current project to sbt (in build file:/usr/local/sbt/)
[info] 0.1-SNAPSHOT
root@master:/usr/local/sbt# sbt --help
/usr/local/sbt/sbt: line 3: /usr/local/sbt/: Is a directory
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0

  help                                    Displays this help message or prints detailed help on requested commands (run 'help <command>').
  completions                             Displays a list of completions for the given argument string (run 'completions <string>').
  about                                   Displays basic information about sbt and the build.
  tasks                                   Lists the tasks defined for the current project.
  settings                                Lists the settings defined for the current project.
  reload                                  (Re)loads the current project or changes to plugins project or returns from it.
  projects                                Lists the names of available projects or temporarily adds/removes extra builds to the session.
  project                                 Displays the current project or changes to the provided `project`.
  set [every] <setting>                   Evaluates a Setting and applies it to the current project.
  session                                 Manipulates session settings.  For details, run 'help session'.
  inspect [uses|tree|definitions] <key>   Prints the value for 'key', the defining scope, delegates, related definitions, and dependencies.
  <log-level>                             Sets the logging level to 'log-level'.  Valid levels: debug, info, warn, error
  plugins                                 Lists currently available plugins.
  ; <command> (; <command>)*              Runs the provided semicolon-separated commands.
  ~ <command>                             Executes the specified command whenever source files change.
  last                                    Displays output from a previous command or the output from a specific task.
  last-grep                               Shows lines from the last output for 'key' that match 'pattern'.
  export <tasks>+                         Executes tasks and displays the equivalent command lines.
  exit                                    Terminates the build.
  --<command>                             Schedules a command to run before other commands on startup.
  show <key>                              Displays the result of evaluating the setting or task associated with 'key'.
  all <task>+                             Executes all of the specified tasks concurrently.

More command help available using 'help <command>' for:
  !, +, ++, <, alias, append, apply, eval, iflast, onFailure, reboot, shell

[info] Set current project to sbt (in build file:/usr/local/sbt/)
> tasks

This is a list of tasks defined for the current project.
It does not list the scopes the tasks are defined in; use the 'inspect' command for that.
Tasks produce values.  Use the 'show' command to run the task and print the resulting value.

  clean            Deletes files produced by the build, such as generated sources, compiled classes, and task caches.
  compile          Compiles sources.
  console          Starts the Scala interpreter with the project classes on the classpath.
  consoleProject   Starts the Scala interpreter with the sbt and the build definition on the classpath and useful imports.
  consoleQuick     Starts the Scala interpreter with the project dependencies on the classpath.
  copyResources    Copies resources to the output directory.
  doc              Generates API documentation.
  package          Produces the main artifact, such as a binary jar.  This is typically an alias for the task that actually does the packaging.
  packageBin       Produces a main artifact, such as a binary jar.
  packageDoc       Produces a documentation artifact, such as a jar containing API documentation.
  packageSrc       Produces a source artifact, such as a jar containing sources and resources.
  publish          Publishes artifacts to a repository.
  publishLocal     Publishes artifacts to the local Ivy repository.
  publishM2        Publishes artifacts to the local Maven repository.
  run              Runs a main class, passing along arguments provided on the command line.
  runMain          Runs the main class selected by the first argument, passing the remaining arguments to the main method.
  test             Executes all tests.
  testOnly         Executes the tests provided as arguments or all tests if no arguments are provided.
  testQuick        Executes the tests that either failed before, were not run or whose transitive dependencies changed, among those provided as arguments.
  update           Resolves and optionally retrieves dependencies, producing a report.

More tasks may be viewed by increasing verbosity.  See 'help tasks'.

最后结果 还是用0.13的版本吧,1.x的版本的交互式不大会用,挺麻烦的 下载

  1. http://www.scala-sbt.org/download.html
  2. 上传到docker 中的容器中
  3. 解压到/usr/local/sbt/ (如果没有就创建该文件夹)
  4. 在该目录下创建sbt文件 输入
  5. 修改~/。bashrc文件 使~/.bashrc生效 source ~/.bashrc
  6. 输入./sbt sbt-version 下载相关依赖
  7. 下载完成后,在工程目录使用/usr/local/sbt/sbt package 打包成jar文件

© 著作权归作者所有

粉丝 2
博文 26
码字总数 14893
作品 0
青岛
其他
私信 提问
如何使用 Docker 部署一个基于 Play Framework 的 Scala Web 应用?

本文作者 Jacek Laskowski 拥有近20年的应用程序开发经验,现 CodiLime 的软件开发团队 Leader,曾从 IBM 取得多种资格认证。在这篇博文中,Jacek 分享了 Warsaw Scala Enthusiasts Meetup ...

OneAPM蓝海讯通
2015/08/10
350
2
Scala构建工具(SBT)教程

我们使用 sbt 创建、测试、运行和提交作业。该教程会解释你在我们的课程中将会用到的所有 sbt 命令。工具安装页说明了如何安装 sbt。 启动 sbt 要启动 sbt,打开一个终端(Windows 中的”命令...

openthings
2015/12/24
536
0
断网机部署使用idea intellij+sbt+scala

如题,希望在断网机(一下都不能连互联网的)部署使用idea intellij+sbt+scala,遇到了sbt必须联网的问题。我的解决方案是在另一台可以上互联网的机器上(linux),搭建idea intellij+sbt+s...

kaiyuanzhe
2015/01/30
2.8K
1
Ubuntu上手动安装sbt

Ubuntu上手动安装sbt sbt(Simple Build Tool,简单构建工具),对Scala或Java语言进行编译,类似于Maven或Ant,它需要jdk1.6或更高的版本支持。sbt可以在windows或Linux环境下安装使用 1、下...

ericSM
2016/06/22
90
0
Windows7 64位 Spark 开发IDE 配置

一、配置所需资源 IDE 环境配置所需材料如下: java jdk1.8 idea, sbt, 下载最新 maven, 二进制包即可 二、配置步骤 1 . 首先在本机安装java环境 2 . 安装idea 3 . 安装sbt, 检查默认是否...

kakasyw
2017/04/13
0
0

没有更多内容

加载失败,请刷新页面

加载更多

《Designing.Data-Intensive.Applications》笔记 四

第九章 一致性与共识 分布式系统最重要的的抽象之一是共识(consensus):让所有的节点对某件事达成一致。 最终一致性(eventual consistency)只提供较弱的保证,需要探索更高的一致性保证(stro...

丰田破产标志
今天
6
0
docker 使用mysql

1, 进入容器 比如 myslq1 里面进行操作 docker exec -it mysql1 /bin/bash 2. 退出 容器 交互: exit 3. mysql 启动在容器里面,并且 可以本地连接mysql docker run --name mysql1 --env MY...

之渊
今天
7
0
python数据结构

1、字符串及其方法(案例来自Python-100-Days) def main(): str1 = 'hello, world!' # 通过len函数计算字符串的长度 print(len(str1)) # 13 # 获得字符串首字母大写的...

huijue
今天
5
0
OSChina 周日乱弹 —— 我,小小编辑,食人族酋长

Osc乱弹歌单(2019)请戳(这里) 【今日歌曲】 @宇辰OSC :分享娃娃的单曲《飘洋过海来看你》: #今日歌曲推荐# 《飘洋过海来看你》- 娃娃 手机党少年们想听歌,请使劲儿戳(这里) @宇辰OSC...

小小编辑
今天
1K
11
MongoDB系列-- SpringBoot 中对 MongoDB 的 基本操作

SpringBoot 中对 MongoDB 的 基本操作 Database 库的创建 首先 在MongoDB 操作客户端 Robo 3T 中 创建数据库: 增加用户User: 创建 Collections 集合(类似mysql 中的 表): 后面我们大部分都...

TcWong
今天
40
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部