简体   繁体   English

Apache Spark 在 Amazon EC2 上构建错误并导致 Spark-Maven-Plugin 失败

[英]Apache Spark building on Amazon EC2 error with Spark-Maven-Plugin failure

I am currently building Apache Spark on Amazon EC2 linux VMs, following these instructions .我目前正在按照 这些说明在 Amazon EC2 linux VM 上构建 Apache Spark。

The tools I am using for the building:我用于建筑的工具:

apache-maven: 3.2.5;阿帕奇-Maven:3.2.5;

scala: 2.10.4;标度:2.10.4;

zinc: 0.3.5.3;锌:0.3.5.3;

Java: jdk1.7.0_79 Java:jdk1.7.0_79

Linux 32bits Linux 32位

This error message is raised:引发此错误消息:

Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.0:testCompile (scala-test-compile-first) on project spark-core_2.10: Execution scala-test-compile-first of goal net.alchim31.maven:scala-maven-plugin:3.2.0:testCompile failed. CompileFailed -> [Help 1]

[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

The website suggests that the error could be caused by a plugin failure, but provides no details.该网站暗示该错误可能是由插件故障引起的,但没有提供详细信息。 What is the problem?问题是什么? Is there an approach I can take to resolve the error?有没有我可以采取的方法来解决错误?

You can use the following pom.xml to build your project您可以使用以下 pom.xml 来构建您的项目

<properties>
  <spark.version>2.3.2</spark.version>
  <scala.version>2.11.12</scala.version>
  <scala.compat.version>2.11</scala.compat.version>
</properties>

<dependencies>
  <dependency>
    <groupId>org.scala-lang</groupId>
    <artifactId>scala-library</artifactId>
    <version>${scala.version}</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-core_${scala.compat.version}</artifactId>
    <version>${spark.version}</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-sql_${scala.compat.version}</artifactId>
    <version>${spark.version}</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-hive_${scala.compat.version}</artifactId>
    <version>${spark.version}</version>
    <scope>provided</scope>
  </dependency>
</dependencies>
<build>
  <sourceDirectory>src/main/scala</sourceDirectory>
  <testSourceDirectory>src/test/scala</testSourceDirectory>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>package.name.of.main.object</mainClass> <!-- add the path to file containing main method e.g com.company.code.ObjectName -->
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
      <executions>
        <execution>
          <id>make-assembly</id>
          <phase>package</phase>
          <goals>
            <goal>single</goal>
          </goals>
        </execution>
      </executions>
    </plugin>

    <plugin>
      <groupId>net.alchim31.maven</groupId>
      <artifactId>scala-maven-plugin</artifactId>
      <version>3.1.0</version>
      <executions>
        <execution>
          <!-- <phase>compile</phase> -->
          <goals>
            <goal>compile</goal>
            <goal>testCompile</goal>
          </goals>
        </execution>
      </executions>
    </plugin>

    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.3</version>
      <configuration>
        <source>1.8</source>
        <target>1.8</target>
      </configuration>
    </plugin>
</build>

in the directory containing the pom file run the command: mvn clean install , and your project would be made available as an uber/fat jar in the target directory.在包含 pom 文件的目录中运行命令: mvn clean install ,您的项目将作为目标目录中的 uber/fat jar 提供。 You can then pass the JAR to spark-submit as usual.然后,您可以像往常一样将 JAR 传递给 spark-submit。

Please keep the following points in mind:请记住以下几点:

  1. Spark and Scala do not support Java 1.7. Spark 和 Scala 不支持 Java 1.7。 If you wish to use the latest Spark 2.x series, you have to use Scala 2.11/2.12 in your dependencies.如果你想使用最新的 Spark 2.x 系列,你必须在你的依赖项中使用 Scala 2.11/2.12。
  2. If you are using Spark 1.6, prefer using Scala 2.11, since the support for Scala 2.10, would not be so readily available.如果您使用的是 Spark 1.6,则更喜欢使用 Scala 2.11,因为对 Scala 2.10 的支持不会那么容易获得。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM