如何使用Gradle构建Apache Spark?

时间:2016-07-19 10:40:33

标签: java maven gradle apache-spark

我正在尝试在Eclipse中用Java构建Apache Spark应用程序。我使用Gradle作为我的构建管理系统。我应该在build.gradle中编写什么以及我应该使用哪些gradle命令来执行与此Maven POM和终端命令相同的操作?

<project>
  <groupId>edu.berkeley</groupId>
  <artifactId>simple-project</artifactId>
  <modelVersion>4.0.0</modelVersion>
  <name>Simple Project</name>
  <packaging>jar</packaging>
  <version>1.0</version>
  <dependencies>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-core_2.10</artifactId>
      <version>1.6.1</version>
    </dependency>
  </dependencies>
</project>

mvn package

$ YOUR_SPARK_HOME/bin/spark-submit \
--class "SimpleApp" \
--master local[4] \
target/simple-project-1.0.jar

1 个答案:

答案 0 :(得分:2)

试试这个。如果是Java项目,则可以删除第一行:

apply plugin: 'scala'

buildscript {
    repositories {
        mavenCentral()
    }
}

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies{
    compile "org.apache.spark:spark-core_2.10:1.6.1"
}