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

相关文章

python管理工具之conda安装部署及使用详解

《python管理工具之conda安装部署及使用详解》这篇文章详细介绍了如何安装和使用conda来管理Python环境,它涵盖了从安装部署、镜像源配置到具体的conda使用方法,包括创建、激活、安装包... 目录pytpshheraerUhon管理工具:conda部署+使用一、安装部署1、 下载2、 安装3

龙蜥操作系统Anolis OS-23.x安装配置图解教程(保姆级)

《龙蜥操作系统AnolisOS-23.x安装配置图解教程(保姆级)》:本文主要介绍了安装和配置AnolisOS23.2系统,包括分区、软件选择、设置root密码、网络配置、主机名设置和禁用SELinux的步骤,详细内容请阅读本文,希望能对你有所帮助... ‌AnolisOS‌是由阿里云推出的开源操作系统,旨

Ubuntu系统怎么安装Warp? 新一代AI 终端神器安装使用方法

《Ubuntu系统怎么安装Warp?新一代AI终端神器安装使用方法》Warp是一款使用Rust开发的现代化AI终端工具,该怎么再Ubuntu系统中安装使用呢?下面我们就来看看详细教程... Warp Terminal 是一款使用 Rust 开发的现代化「AI 终端」工具。最初它只支持 MACOS,但在 20

mysql-8.0.30压缩包版安装和配置MySQL环境过程

《mysql-8.0.30压缩包版安装和配置MySQL环境过程》该文章介绍了如何在Windows系统中下载、安装和配置MySQL数据库,包括下载地址、解压文件、创建和配置my.ini文件、设置环境变量... 目录压缩包安装配置下载配置环境变量下载和初始化总结压缩包安装配置下载下载地址:https://d

LinuxMint怎么安装? Linux Mint22下载安装图文教程

《LinuxMint怎么安装?LinuxMint22下载安装图文教程》LinuxMint22发布以后,有很多新功能,很多朋友想要下载并安装,该怎么操作呢?下面我们就来看看详细安装指南... linux Mint 是一款基于 Ubuntu 的流行发行版,凭借其现代、精致、易于使用的特性,深受小伙伴们所喜爱。对

Linux(Centos7)安装Mysql/Redis/MinIO方式

《Linux(Centos7)安装Mysql/Redis/MinIO方式》文章总结:介绍了如何安装MySQL和Redis,以及如何配置它们为开机自启,还详细讲解了如何安装MinIO,包括配置Syste... 目录安装mysql安装Redis安装MinIO总结安装Mysql安装Redis搜索Red

python安装完成后可以进行的后续步骤和注意事项小结

《python安装完成后可以进行的后续步骤和注意事项小结》本文详细介绍了安装Python3后的后续步骤,包括验证安装、配置环境、安装包、创建和运行脚本,以及使用虚拟环境,还强调了注意事项,如系统更新、... 目录验证安装配置环境(可选)安装python包创建和运行Python脚本虚拟环境(可选)注意事项安装

gradle安装和环境配置全过程

《gradle安装和环境配置全过程》本文介绍了如何安装和配置Gradle环境,包括下载Gradle、配置环境变量、测试Gradle以及在IntelliJIDEA中配置Gradle... 目录gradle安装和环境配置1 下载GRADLE2 环境变量配置3 测试gradle4 设置gradle初始化文件5 i

Jsoncpp的安装与使用方式

《Jsoncpp的安装与使用方式》JsonCpp是一个用于解析和生成JSON数据的C++库,它支持解析JSON文件或字符串到C++对象,以及将C++对象序列化回JSON格式,安装JsonCpp可以通过... 目录安装jsoncppJsoncpp的使用Value类构造函数检测保存的数据类型提取数据对json数

mac安装redis全过程

《mac安装redis全过程》文章内容主要介绍了如何从官网下载指定版本的Redis,以及如何在自定义目录下安装和启动Redis,还提到了如何修改Redis的密码和配置文件,以及使用RedisInsig... 目录MAC安装Redis安装启动redis 配置redis 常用命令总结mac安装redis官网下