scala安装搭建和基础语法

scala的安装搭建

scala的下载地址
https://www.scala-lang.org/download/

scala在IDEA上的插件下载地址
https://plugins.jetbrains.com/plugin/1347-scala/versions

windows版本直接解压zip到指定目录下(不要中文路径),然后配置环境变量即可:
在这里插入图片描述

在这里插入图片描述

验证是否安装成功:

在这里插入图片描述

将下载下来的插件zip文件解压到IDEA的安装根目录下的plugins文件夹里面中,重启IDEA即可,也可以直接在IDEA上下载
在这里插入图片描述

导入scala插件:
选择project structure
在这里插入图片描述

选择“+”,添加scala的SDK
在这里插入图片描述
点击"Browse" ,并选择scala的安装目录:

在这里插入图片描述

安装完成后:
在这里插入图片描述
查看能否创建scala类:
在这里插入图片描述

所需的POM文件配置:

  <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.11.8</version>
            <!-- 如果想要用java -jar 来运行我们打包之后的jar包,则下面这个配置必须注释掉 -->
            <!-- <scope>provided</scope>-->
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- 限制jdk版本插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <!-- 编译scala需要用到的插件 -->
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.2.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值