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
由于国内的网络问题,安装比较费时间,在安装好后,可用执行如下命令备份或恢复安装环境。
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
参考:
标签:coursier,sbt,scala,com,Scala,https,Ubuntu,cs,WSL2 From: https://www.cnblogs.com/terry-cc/p/17963141