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

相关文章

虚拟机Centos7安装MySQL数据库实践

《虚拟机Centos7安装MySQL数据库实践》用户分享在虚拟机安装MySQL的全过程及常见问题解决方案,包括处理GPG密钥、修改密码策略、配置远程访问权限及防火墙设置,最终通过关闭防火墙和停止Net... 目录安装mysql数据库下载wget命令下载MySQL安装包安装MySQL安装MySQL服务安装完成

JAVA中安装多个JDK的方法

《JAVA中安装多个JDK的方法》文章介绍了在Windows系统上安装多个JDK版本的方法,包括下载、安装路径修改、环境变量配置(JAVA_HOME和Path),并说明如何通过调整JAVA_HOME在... 首先去oracle官网下载好两个版本不同的jdk(需要登录Oracle账号,没有可以免费注册)下载完

Java JDK1.8 安装和环境配置教程详解

《JavaJDK1.8安装和环境配置教程详解》文章简要介绍了JDK1.8的安装流程,包括官网下载对应系统版本、安装时选择非系统盘路径、配置JAVA_HOME、CLASSPATH和Path环境变量,... 目录1.下载JDK2.安装JDK3.配置环境变量4.检验JDK官网下载地址:Java Downloads

SQL server数据库如何下载和安装

《SQLserver数据库如何下载和安装》本文指导如何下载安装SQLServer2022评估版及SSMS工具,涵盖安装配置、连接字符串设置、C#连接数据库方法和安全注意事项,如混合验证、参数化查... 目录第一步:打开官网下载对应文件第二步:程序安装配置第三部:安装工具SQL Server Manageme

SpringBoot结合Docker进行容器化处理指南

《SpringBoot结合Docker进行容器化处理指南》在当今快速发展的软件工程领域,SpringBoot和Docker已经成为现代Java开发者的必备工具,本文将深入讲解如何将一个SpringBo... 目录前言一、为什么选择 Spring Bootjavascript + docker1. 快速部署与

使用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分支和标签的