idea中scala編程環境及建立maven工程
1、下載idea軟件並破解:http://blog.csdn.net/nn_jbrs/article/details/70139178
2、安裝scala
首先在安裝好了idea后,要運行scala程序首先在自己的主機上安裝Scala,scala的安裝參考百度經驗:http://jingyan.baidu.com/article/d5a880ebb2e51a13f047cc46.html
3、scala插件安裝
在idea上運行Scala需要安裝Scala插件具體方法參照下面的網頁:http://blog.csdn.net/stark_summer/article/details/42460527
在沒有聯網的情況下,如果本地已經有下載好的插件,則直接將路徑改變為存放Scala插件的地方,在連網的情況下直接下載插件。
這樣就可以運行Scala文件。
4、建立maven工程:
首先本地下載安裝maven,有免安裝的版本。然后配置好自己的本地倉庫以及配置好settings文件。
idea中點擊file-》seting-》bulid-》maven 配置maven路徑,這樣就可以建立maven工程了。
如果采用maven打包默認只打包Java下的文件,所以在要在pom.xml文件中配置maven-scala插件。具體的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>com.test.maven</groupId>
<artifactId>Streaming</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.7</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>2.11.7</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
<version>2.11.7</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
</dependency>
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.10</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>