本帖最后由 hery 于 2015-12-18 17:55 编辑
在pom文件中加入spark就报错。Error:scalac: error while loading <root>, error in opening zip file
Error:Module 'sparktest' production: scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found.
scal文件内容:
package cn.hery.spark.test
/**
* Created by hery on 2015/12/18.
*/
object Demo {
def main (args: Array[String]) {
val name="jack"
// println(name)
// Console.println("你好")
// Console.println(add(1,2))
// helloscala()
// Console.println(Sayhello("scala"))
}
// def add=(x:Int,y:Int) => x+y
//
// def Sayhello(name:String):String = {
// return "hello " + name
// }
//
// def helloscala(){
// return Console.println("hello scala")
// }
}
pom文件内容:
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>2.10.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.5</version>
</dependency>
<!--spark-->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.5.0</version>
</dependency>
pom文件的全部内容:<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>cn.hery.spark</groupId>
<artifactId>sparktest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sparktest</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>cloudera</id>
<url>https://repository.cloudera.com/cloudera/cloudera-repos</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!--scala-->
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>2.10.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.5</version>
</dependency>
<!--spark-->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.5.0</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.spark</groupId>-->
<!--<artifactId>spark-core_2.10</artifactId>-->
<!--<version>1.3.0-cdh5.4.2</version>-->
<!--<scope>provided</scope>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.apache.spark</groupId>-->
<!--<artifactId>spark-streaming_2.10</artifactId>-->
<!--<version>1.3.0-cdh5.4.2</version>-->
<!--<scope>provided</scope>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.apache.spark</groupId>-->
<!--<artifactId>spark-mllib_2.10</artifactId>-->
<!--<version>1.3.0</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.apache.spark</groupId>-->
<!--<artifactId>spark-sql_2.10</artifactId>-->
<!--<version>1.3.0</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.apache.spark</groupId>-->
<!--<artifactId>spark-streaming_2.10</artifactId>-->
<!--<version>1.3.0</version>-->
<!--</dependency>-->
<dependency>
<groupId>de.bwaldvogel</groupId>
<artifactId>liblinear</artifactId>
<version>1.95</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.5</version>
</dependency>
</dependencies>
<!--<build>-->
<!--<!–<sourceDirectory>src/main/scala</sourceDirectory>–>-->
<!--<!–<testSourceDirectory>src/test/scala</testSourceDirectory>–>-->
<!--<plugins>-->
<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-surefire-plugin</artifactId>-->
<!--<version>2.18.1</version>-->
<!--<configuration>-->
<!--<skip>true</skip>-->
<!--</configuration>-->
<!--</plugin>-->
<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-compiler-plugin</artifactId>-->
<!--<version>3.2</version>-->
<!--<configuration>-->
<!--<source>1.8</source>-->
<!--<target>1.8</target>-->
<!--</configuration>-->
<!--</plugin>-->
<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-resources-plugin</artifactId>-->
<!--<version>2.7</version>-->
<!--<configuration>-->
<!--<encoding>UTF-8</encoding>-->
<!--</configuration>-->
<!--</plugin>-->
<!--<!– the Maven Scala plugin will compile Scala source files –>-->
<!--<plugin>-->
<!--<groupId>net.alchim31.maven</groupId>-->
<!--<artifactId>scala-maven-plugin</artifactId>-->
<!--<version>3.2.2</version>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>compile-scala</id>-->
<!--<phase>compile</phase>-->
<!--<goals>-->
<!--<goal>add-source</goal>-->
<!--<goal>compile</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--<execution>-->
<!--<id>test-compile-scala</id>-->
<!--<phase>test-compile</phase>-->
<!--<goals>-->
<!--<goal>add-source</goal>-->
<!--<goal>testCompile</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<!--<configuration>-->
<!--<scalaVersion>2.10.5</scalaVersion>-->
<!--</configuration>-->
<!--</plugin>-->
<!--</plugins>-->
<!--</build>-->
</project>
|
|