Scala的安装及环境配置
Scala的安装及环境配置
一、本地安装
1.安装Scala到C盘上
( 提取码:346r )
2.配置本地环境变量
3.检测是否安装完成
二、IDEA安装Scala
(1)新建一个maven项目
(2)修改依赖配置 pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>scala_test</groupId> <artifactId>scala</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>2.11.8</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <version>3.2.2</version> <executions> <execution> <goals> <goal>compile</goal> <goal>testCompile</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> <configuration> <archive> <manifest> <mainClass>com.oracle.scala.lesson.HelloWorld</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin> </plugins> </build> </project>
(3)将java文件名改为scala
(4)下载Scala插件
-
这里提供 提取码:914s *
(5)重启idea (6)编写一个Scala程序
object HelloWorld { def main(args: Array[String]): Unit = { println("HelloWorld") } }
(7)运行结果
三、在本地后台运行Scala的jar包
(1)获取程序路径 (2)修改依赖中的路径 (3)打包 (4)获取路径在后台中运行 (5)使用Scala命令运行
上一篇:
JS实现多线程数据分片下载