docker 内sbt安装

2024-02-24 07:48
文章标签 安装 docker sbt

本文主要是介绍docker 内sbt安装,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

安装
准备安装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

2) 手动安装
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.0help                                    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, errorplugins                                 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/)
> tasksThis 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文件
a. 输入
b.
5. 修改~/。bashrc文件
a.
b. 使~/.bashrc生效 source ~/.bashrc
6. 输入./sbt sbt-version 下载相关依赖
7. 下载完成后,在工程目录使用/usr/local/sbt/sbt package 打包成jar文件

这篇关于docker 内sbt安装的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/741426

相关文章

mac安装nvm(node.js)多版本管理实践步骤

《mac安装nvm(node.js)多版本管理实践步骤》:本文主要介绍mac安装nvm(node.js)多版本管理的相关资料,NVM是一个用于管理多个Node.js版本的命令行工具,它允许开发者在... 目录NVM功能简介MAC安装实践一、下载nvm二、安装nvm三、安装node.js总结NVM功能简介N

Docker部署Jenkins持续集成(CI)工具的实现

《Docker部署Jenkins持续集成(CI)工具的实现》Jenkins是一个流行的开源自动化工具,广泛应用于持续集成(CI)和持续交付(CD)的环境中,本文介绍了使用Docker部署Jenkins... 目录前言一、准备工作二、设置变量和目录结构三、配置 docker 权限和网络四、启动 Jenkins

python安装whl包并解决依赖关系的实现

《python安装whl包并解决依赖关系的实现》本文主要介绍了python安装whl包并解决依赖关系的实现,文中通过图文示例介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录一、什么是whl文件?二、我们为什么需要使用whl文件来安装python库?三、我们应该去哪儿下

MySQL安装时initializing database失败的问题解决

《MySQL安装时initializingdatabase失败的问题解决》本文主要介绍了MySQL安装时initializingdatabase失败的问题解决,文中通过图文介绍的非常详细,对大家的学... 目录问题页面:解决方法:问题页面:解决方法:1.勾选红框中的选项:2.将下图红框中全部改为英

MySQL9.0默认路径安装下重置root密码

《MySQL9.0默认路径安装下重置root密码》本文主要介绍了MySQL9.0默认路径安装下重置root密码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们... 目录问题描述环境描述解决方法正常模式下修改密码报错原因问题描述mysqlChina编程采用默认安装路径,

Python使用国内镜像加速pip安装的方法讲解

《Python使用国内镜像加速pip安装的方法讲解》在Python开发中,pip是一个非常重要的工具,用于安装和管理Python的第三方库,然而,在国内使用pip安装依赖时,往往会因为网络问题而导致速... 目录一、pip 工具简介1. 什么是 pip?2. 什么是 -i 参数?二、国内镜像源的选择三、如何

ElasticSearch+Kibana通过Docker部署到Linux服务器中操作方法

《ElasticSearch+Kibana通过Docker部署到Linux服务器中操作方法》本文介绍了Elasticsearch的基本概念,包括文档和字段、索引和映射,还详细描述了如何通过Docker... 目录1、ElasticSearch概念2、ElasticSearch、Kibana和IK分词器部署

Python安装时常见报错以及解决方案

《Python安装时常见报错以及解决方案》:本文主要介绍在安装Python、配置环境变量、使用pip以及运行Python脚本时常见的错误及其解决方案,文中介绍的非常详细,需要的朋友可以参考下... 目录一、安装 python 时常见报错及解决方案(一)安装包下载失败(二)权限不足二、配置环境变量时常见报错及

docker如何删除悬空镜像

《docker如何删除悬空镜像》文章介绍了如何使用Docker命令删除悬空镜像,以提高服务器空间利用率,通过使用dockerimage命令结合filter和awk工具,可以过滤出没有Tag的镜像,并将... 目录docChina编程ker删除悬空镜像前言悬空镜像docker官方提供的方式自定义方式总结docker

MySQL8.2.0安装教程分享

《MySQL8.2.0安装教程分享》这篇文章详细介绍了如何在Windows系统上安装MySQL数据库软件,包括下载、安装、配置和设置环境变量的步骤... 目录mysql的安装图文1.python访问网址2javascript.点击3.进入Downloads向下滑动4.选择Community Server5.