【问题标题】:Apache Spark building on Amazon EC2 error with Spark-Maven-Plugin failureApache Spark 在 Amazon EC2 上构建错误并出现 Spark-Maven-Plugin 故障
【发布时间】:2020-06-13 16:12:46
【问题描述】:

我目前正在 Amazon EC2 linux 虚拟机上构建 Apache Spark,关注 these instructions

我用于建筑的工具:

apache-maven: 3.2.5;

scala:2.10.4;

锌:0.3.5.3;

Java:jdk1.7.0_79

Linux 32 位

出现此错误消息:

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

该网站暗示该错误可能是由插件故障引起的,但未提供详细信息。问题是什么?有什么方法可以解决这个错误吗?

【问题讨论】:

  • 您是否尝试过 -e 或 -X 进行更多调试?
  • 是的,我做到了,它只会弹出更多难以跟踪的错误信息,太多了,无法将其包含在评论中:
  • @bcxuezhe39 你能发布你的pom文件吗? 这些说明的链接似乎已损坏
  • 很抱歉没有及时看到您的共同点。奇怪的是,在google cluster上尝试了同样的操作后,构建成功了。仍然不知道为什么在 ec2 上构建还不起作用。内存是一个可能的问题吗? (google instance 有 3.75 GB 内存,ec2 micro instance 有 1gb)

标签: java scala maven amazon-web-services amazon-ec2


【解决方案1】:

您可以使用以下 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>

在包含 pom 文件的目录中运行命令:mvn clean install,您的项目将作为目标目录中的 uber/fat jar 可用。 然后,您可以像往常一样将 JAR 传递给 spark-submit。

请记住以下几点:

  1. Spark 和 Scala 不支持 Java 1.7。如果您想使用 最新的 Spark 2.x 系列,你必须在你的 依赖关系。
  2. 如果您使用的是 Spark 1.6,最好使用 Scala 2.11,因为支持 对于 Scala 2.10,不会那么容易获得。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-10
    • 2015-10-31
    • 1970-01-01
    • 2015-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多