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

相关文章

使用Docker构建Python Flask程序的详细教程

《使用Docker构建PythonFlask程序的详细教程》在当今的软件开发领域,容器化技术正变得越来越流行,而Docker无疑是其中的佼佼者,本文我们就来聊聊如何使用Docker构建一个简单的Py... 目录引言一、准备工作二、创建 Flask 应用程序三、创建 dockerfile四、构建 Docker

SpringBoot+Docker+Graylog 如何让错误自动报警

《SpringBoot+Docker+Graylog如何让错误自动报警》SpringBoot默认使用SLF4J与Logback,支持多日志级别和配置方式,可输出到控制台、文件及远程服务器,集成ELK... 目录01 Spring Boot 默认日志框架解析02 Spring Boot 日志级别详解03 Sp

Python中win32包的安装及常见用途介绍

《Python中win32包的安装及常见用途介绍》在Windows环境下,PythonWin32模块通常随Python安装包一起安装,:本文主要介绍Python中win32包的安装及常见用途的相关... 目录前言主要组件安装方法常见用途1. 操作Windows注册表2. 操作Windows服务3. 窗口操作

java实现docker镜像上传到harbor仓库的方式

《java实现docker镜像上传到harbor仓库的方式》:本文主要介绍java实现docker镜像上传到harbor仓库的方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地... 目录1. 前 言2. 编写工具类2.1 引入依赖包2.2 使用当前服务器的docker环境推送镜像2.2

gitlab安装及邮箱配置和常用使用方式

《gitlab安装及邮箱配置和常用使用方式》:本文主要介绍gitlab安装及邮箱配置和常用使用方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1.安装GitLab2.配置GitLab邮件服务3.GitLab的账号注册邮箱验证及其分组4.gitlab分支和标签的

MySQL MCP 服务器安装配置最佳实践

《MySQLMCP服务器安装配置最佳实践》本文介绍MySQLMCP服务器的安装配置方法,本文结合实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下... 目录mysql MCP 服务器安装配置指南简介功能特点安装方法数据库配置使用MCP Inspector进行调试开发指

在Windows上使用qemu安装ubuntu24.04服务器的详细指南

《在Windows上使用qemu安装ubuntu24.04服务器的详细指南》本文介绍了在Windows上使用QEMU安装Ubuntu24.04的全流程:安装QEMU、准备ISO镜像、创建虚拟磁盘、配置... 目录1. 安装QEMU环境2. 准备Ubuntu 24.04镜像3. 启动QEMU安装Ubuntu4

Python UV安装、升级、卸载详细步骤记录

《PythonUV安装、升级、卸载详细步骤记录》:本文主要介绍PythonUV安装、升级、卸载的详细步骤,uv是Astral推出的下一代Python包与项目管理器,主打单一可执行文件、极致性能... 目录安装检查升级设置自动补全卸载UV 命令总结 官方文档详见:https://docs.astral.sh/

Nexus安装和启动的实现教程

《Nexus安装和启动的实现教程》:本文主要介绍Nexus安装和启动的实现教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、Nexus下载二、Nexus安装和启动三、关闭Nexus总结一、Nexus下载官方下载链接:DownloadWindows系统根

Java SWT库详解与安装指南(最新推荐)

《JavaSWT库详解与安装指南(最新推荐)》:本文主要介绍JavaSWT库详解与安装指南,在本章中,我们介绍了如何下载、安装SWTJAR包,并详述了在Eclipse以及命令行环境中配置Java... 目录1. Java SWT类库概述2. SWT与AWT和Swing的区别2.1 历史背景与设计理念2.1.