首页 > 系统相关 >WSL2下Ubuntu中的Scala环境安装

WSL2下Ubuntu中的Scala环境安装

时间:2024-01-13 22:44:54浏览次数:32  
标签:coursier sbt scala com Scala https Ubuntu cs WSL2

sudo sed -i 's/http:\/\/archive.ubuntu.com/https:\/\/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sudo apt update && sudo apt upgrade -y
sudo apt install openjdk-17-jdk -y


vi ~/.profile
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
export COURSIER_REPOSITORIES="ivy2Local|central|sonatype:releases|jitpack|https://corporate.com/repo"


source ~/.profile

which java

curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs

./cs setup

https://github.com/coursier/coursier/releases/download/v2.1.8/cs-x86_64-pc-linux.gz
\\wsl.localhost\Ubuntu-22.04\home\cc\.cache\coursier\v1\https\github.com\coursier\coursier\releases\download\v2.1.8\cs-x86_64-pc-linux.gz

\\wsl.localhost\Ubuntu-22.04\home\cc\.cache\coursier\v1\https\github.com\VirtusLab\scala-cli\releases\download\v1.1.1\scala-cli-x86_64-pc-linux.gz

https://github.com/sbt/sbt/releases/download/v1.9.8/sbt-1.9.8.zip
\\wsl.localhost\Ubuntu-22.04\home\cc\.cache\coursier\v1\https\github.com\sbt\sbt\releases\download\v1.9.8\sbt-1.9.8.zip

./cs list
./cs update
./cs update scala
./cs install scala:3.3.1 && cs install scalac:3.3.1
./cs launch scalaa:3.3.1

vi ~/.sbt/repositories
[repositories]
local
aliyunmaven: https://maven.aliyun.com/repository/public
central-repos1: https://repo1.maven.org/maven2/


mkdir -p /mnt/d/Study/ScalaProjects && cd "$_"
sbt new scala/hello-world.g8

vi /mnt/d/Study/ScalaProjects/hello-scala3/project/build.properties
sbt.version=1.9.7 -> 1.9.8

vi /mnt/d/Study/ScalaProjects/hello-scala3/build.sbt
scalaVersion := 2.13.12 -> "3.3.1"

cd  /mnt/d/Study/ScalaProjects/hello-scala3

sbt run

 

cd  /mnt/d/Study/ScalaProjects

sbt new playframework/play-scala-seed.g8
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
This template generates a Play Scala project

name [play-scala-seed]: hello-play
organization [com.example]: org.penguin
play_version [3.0.1]:
scala_version [2.13.12]:
sbt_giter8_scaffold_version [0.16.2]:

Template applied in /mnt/d/Study/ScalaProjects/./hello-play

cd hello-play/
sbt run

http://localhost:9000/

由于国内的网络问题,安装比较费时间,在安装好后,可用执行如下命令备份或恢复安装环境。

tar --xattrs --xattrs-include=* -zcvf scala-env.tar.gz .cache .config .g8 .ivy2 .local .sbt cs hello-scala3 .motd_shown
tar --xattrs --xattrs-include=* -zxvf scala-env.tar.gz

参考:

JDK和Scala版本的关系

SBT仓库的配置

创建Play项目

标签:coursier,sbt,scala,com,Scala,https,Ubuntu,cs,WSL2
From: https://www.cnblogs.com/terry-cc/p/17963141

相关文章

  • Scala编程语言day1
    一、Scala概述Scala是一种运行在JVM上的函数式的面向对象语言,它集成了面向对象编程和面向函数式编程的各种特性,以及更高层的并发模型Scala的语言特点Scala是兼容的:兼容Java,可以访问庞大的Java类库Scala是精简的:Scala表达能力强,开发速度快Scala是高级的:Scala可以让你的程序保......
  • Ubuntu下运行LVGL模拟器
    目录一、前言二、下载并安装VSCode(方法很多,总之装好VSCode就行了)三、获取源码3.2方法一:从Github拉取源码(有梯子)3.3方法二:从Gitee码云拉取源码(无梯子)四、安装LinuxSDL2驱动五、编译源码一、前言​ LVGL是一个可高度可裁剪、低资源占用、界面美观且易用的C语言嵌入式系统......
  • [Bookmark]--Ubuntu
    1.环境设置ubuntu添加环境变量的四种方法2.命令使用tar.xz解压详解3.嵌入式开发3.1环境配置LibOpenCM3(一)Linux下命令行开发环境配置ArmGNUToolchainDownloads3.2库libopencm3USBHIDTypeDefinitions/************************(C)COPYLEFT2018Merafour**......
  • 【flink番外篇】9、Flink Table API 支持的操作示例(8)- 时态表的join(scala版本)
    文章目录Flink系列文章一、maven依赖二、示例:时态表的join(scala版本)1)、统计需求对应的SQL2)、Withoutconnnector实现代码3)、WithCSVConnector实现代码本文给以scala的语言给出来TableAPI针对时态表的join操作。本文除了maven依赖外,没有其他依赖。本文需要有kafka的运行环境......
  • 解决VMware 虚拟机 ubuntu 20.04 异常关闭导致虚拟网卡 ens33 无法工作问题
    问题描述由于经常使用SSH远程链接VMware中的虚拟机ubuntu,每次关闭都是挂起,时间久了,虚拟机运行有些卡顿了,此时可以通过Linux命令重启或者关闭ubuntu,也可以之间使用VMWare中的【虚拟机】--【电源】->【关闭客户机】强行关闭正在运行的虚拟机但是这个强行关闭正在运行的......
  • VMware 虚拟机 ubuntu 20.04 硬盘扩容方法
    前言最近由于需要编译【RK3568】的LinuxSDK,发现虚拟机默认的200G空间不足了,因此想增加这个200G空间的限制,通过网络上查找了一些方法,加上自己亲自验证,确认硬盘扩容正常,方法也比较的容易,所以做个笔记记录下来。操作步骤如下首先VMware虚拟机ubuntu20.04需要【关机】,......
  • ubuntu 20.04 自由切换 python 的版本
    问题描述当前ubuntu20.04默认安装了多个python的版本,执行python时,默认版本是Python2.7.18zhangsz@zhangsz:~$pythonPython2.7.18(default,Jul12022,12:27:04)[GCC9.4.0]onlinux2Type"help","copyright","credits"or"license"......
  • ubuntu之apt-get updata报错
    在ubuntu16中,当我们输入sudoapt-getupdate会失败可能是网络不好,更多的是源不好输入下面命令,增加一些源sudovim/etc/apt/sources.list把下面的内容复制到开头restricteddeb-srchttp://archive.ubuntu.com/ubuntuxenialmainrestricted#Addedbysoftware-propertiesdebht......
  • Ubuntu 20.04版本安装k8s控制节点
    一、环境配置服务器配置:2核4GIP:192.168.10.23主机名:master4将改主机加入此集群#1.修改主机名hostnamectlset-hostnamemaster4&&bash#2.添加hosts127.0.1.1master4192.168.10.20master192.168.10.21master2192.168.10.22master3192.168.10.23master419......
  • 01 Ubuntu 系统的安装
    软件版本:vitis2021.1(vivado2021.1)操作系统:Ubuntu18.04硬件平台:适用XILINXA7/K7/Z7/ZU/KU系列FPGA登录"米联客"FPGA社区-www.uisrc.com视频课程、答疑解惑!1.1概述    基于XILINXXDMA的开发应用环境需要用到以下软件或者开发包:ubuntu、qt。环境的搭建对于后续的开发至......