2013-03-17 17:47:44 -04:00
---
layout: global
2014-09-16 12:18:03 -04:00
title: Building Spark
redirect_from: "building-with-maven.html"
2013-03-17 17:47:44 -04:00
---
* This will become a table of contents (this text will be scraped).
{:toc}
2016-05-17 11:40:38 -04:00
# Building Apache Spark
2015-05-16 03:18:41 -04:00
2016-05-17 11:40:38 -04:00
## Apache Maven
2015-05-16 03:18:41 -04:00
2016-05-17 11:40:38 -04:00
The Maven-based build is the build of reference for Apache Spark.
Building Spark using Maven requires Maven 3.3.9 or newer and Java 7+.
2016-11-03 20:27:23 -04:00
Note that support for Java 7 is deprecated as of Spark 2.0.0 and may be removed in Spark 2.2.0.
2015-03-17 07:25:01 -04:00
2016-05-17 11:40:38 -04:00
### Setting up Maven's Memory Usage
2013-03-17 17:47:44 -04:00
2016-09-22 05:31:15 -04:00
You'll need to configure Maven to use more memory than usual by setting `MAVEN_OPTS` :
2013-03-17 17:47:44 -04:00
2016-09-22 05:31:15 -04:00
export MAVEN_OPTS="-Xmx2g -XX:ReservedCodeCacheSize=512m"
2013-03-17 17:47:44 -04:00
2016-09-22 05:31:15 -04:00
When compiling with Java 7, you will need to add the additional option "-XX:MaxPermSize=512M" to MAVEN_OPTS.
If you don't add these parameters to `MAVEN_OPTS` , you may see errors and warnings like the following:
2013-03-17 17:47:44 -04:00
2014-02-19 18:54:03 -05:00
[INFO] Compiling 203 Scala sources and 9 Java sources to /Users/me/Development/spark/core/target/scala-{{site.SCALA_BINARY_VERSION}}/classes...
2013-08-27 23:02:30 -04:00
[ERROR] PermGen space -> [Help 1]
2013-03-17 17:47:44 -04:00
2014-02-19 18:54:03 -05:00
[INFO] Compiling 203 Scala sources and 9 Java sources to /Users/me/Development/spark/core/target/scala-{{site.SCALA_BINARY_VERSION}}/classes...
2013-08-27 23:02:30 -04:00
[ERROR] Java heap space -> [Help 1]
2013-03-17 17:47:44 -04:00
2016-09-22 05:31:15 -04:00
[INFO] Compiling 233 Scala sources and 41 Java sources to /Users/me/Development/spark/sql/core/target/scala-{site.SCALA_BINARY_VERSION}/classes...
OpenJDK 64-Bit Server VM warning: CodeCache is full. Compiler has been disabled.
OpenJDK 64-Bit Server VM warning: Try increasing the code cache size using -XX:ReservedCodeCacheSize=
You can fix these problems by setting the `MAVEN_OPTS` variable as discussed before.
2013-03-17 17:47:44 -04:00
[SPARK-4501][Core] - Create build/mvn to automatically download maven/zinc/scalac
Creates a top level directory script (as `build/mvn`) to automatically download zinc and the specific version of scala used to easily build spark. This will also download and install maven if the user doesn't already have it and all packages are hosted under the `build/` directory. Tested on both Linux and OSX OS's and both work. All commands pass through to the maven binary so it acts exactly as a traditional maven call would.
Author: Brennon York <brennon.york@capitalone.com>
Closes #3707 from brennonyork/SPARK-4501 and squashes the following commits:
0e5a0e4 [Brennon York] minor incorrect doc verbage (with -> this)
9b79e38 [Brennon York] fixed merge conflicts with dev/run-tests, properly quoted args in sbt/sbt, fixed bug where relative paths would fail if passed in from build/mvn
d2d41b6 [Brennon York] added blurb about leverging zinc with build/mvn
b979c58 [Brennon York] updated the merge conflict
c5634de [Brennon York] updated documentation to overview build/mvn, updated all points where sbt/sbt was referenced with build/sbt
b8437ba [Brennon York] set progress bars for curl and wget when not run on jenkins, no progress bar when run on jenkins, moved sbt script to build/sbt, wrote stub and warning under sbt/sbt which calls build/sbt, modified build/sbt to use the correct directory, fixed bug in build/sbt-launch-lib.bash to correctly pull the sbt version
be11317 [Brennon York] added switch to silence download progress only if AMPLAB_JENKINS is set
28d0a99 [Brennon York] updated to remove the python dependency, uses grep instead
7e785a6 [Brennon York] added silent and quiet flags to curl and wget respectively, added single echo output to denote start of a download if download is needed
14a5da0 [Brennon York] removed unnecessary zinc output on startup
1af4a94 [Brennon York] fixed bug with uppercase vs lowercase variable
3e8b9b3 [Brennon York] updated to properly only restart zinc if it was freshly installed
a680d12 [Brennon York] Added comments to functions and tested various mvn calls
bb8cc9d [Brennon York] removed package files
ef017e6 [Brennon York] removed OS complexities, setup generic install_app call, removed extra file complexities, removed help, removed forced install (defaults now), removed double-dash from cli
07bf018 [Brennon York] Updated to specifically handle pulling down the correct scala version
f914dea [Brennon York] Beginning final portions of localized scala home
69c4e44 [Brennon York] working linux and osx installers for purely local mvn build
4a1609c [Brennon York] finalizing working linux install for maven to local ./build/apache-maven folder
cbfcc68 [Brennon York] Changed the default sbt/sbt to build/sbt and added a build/mvn which will automatically download, install, and execute maven with zinc for easier build capability
2014-12-27 16:25:18 -05:00
**Note:**
2015-09-08 09:38:10 -04:00
2016-09-22 05:31:15 -04:00
* If using `build/mvn` with no `MAVEN_OPTS` set, the script will automatically add the above options to the `MAVEN_OPTS` environment variable.
* The `test` phase of the Spark build will automatically add these options to `MAVEN_OPTS` , even when not using `build/mvn` .
* You may see warnings like "ignoring option MaxPermSize=1g; support was removed in 8.0" when building or running tests with Java 8 and `build/mvn` . These warnings are harmless.
2014-03-04 01:31:30 -05:00
2016-05-17 11:40:38 -04:00
### build/mvn
Spark now comes packaged with a self-contained Maven installation to ease building and deployment of Spark from source located under the `build/` directory. This script will automatically download and setup all necessary build requirements ([Maven](https://maven.apache.org/), [Scala ](http://www.scala-lang.org/ ), and [Zinc ](https://github.com/typesafehub/zinc )) locally within the `build/` directory itself. It honors any `mvn` binary if present already, however, will pull down its own copy of Scala and Zinc regardless to ensure proper version requirements are met. `build/mvn` execution acts as a pass through to the `mvn` call allowing easy transition from previous build methods. As an example, one can build a version of Spark as follows:
./build/mvn -Pyarn -Phadoop-2.4 -Dhadoop.version=2.4.0 -DskipTests clean package
Other build examples can be found below.
## Building a Runnable Distribution
To create a Spark distribution like those distributed by the
[Spark Downloads ](http://spark.apache.org/downloads.html ) page, and that is laid out so as
to be runnable, use `./dev/make-distribution.sh` in the project root directory. It can be configured
with Maven profile settings and so on like the direct Maven build. Example:
2016-08-26 15:25:22 -04:00
./dev/make-distribution.sh --name custom-spark --tgz -Psparkr -Phadoop-2.4 -Phive -Phive-thriftserver -Pmesos -Pyarn
2016-05-17 11:40:38 -04:00
For more information on usage, run `./dev/make-distribution.sh --help`
## Specifying the Hadoop Version
2013-03-17 17:47:44 -04:00
2015-09-08 09:38:10 -04:00
Because HDFS is not protocol-compatible across versions, if you want to read from HDFS, you'll need to build Spark against the specific HDFS version in your environment. You can do this through the `hadoop.version` property. If unset, Spark will build against Hadoop 2.2.0 by default. Note that certain build profiles are required for particular Hadoop versions:
2014-05-05 13:33:49 -04:00
< table class = "table" >
< thead >
< tr > < th > Hadoop version< / th > < th > Profile required< / th > < / tr >
< / thead >
< tbody >
< tr > < td > 2.2.x< / td > < td > hadoop-2.2< / td > < / tr >
< tr > < td > 2.3.x< / td > < td > hadoop-2.3< / td > < / tr >
< tr > < td > 2.4.x< / td > < td > hadoop-2.4< / td > < / tr >
2016-01-15 20:07:24 -05:00
< tr > < td > 2.6.x< / td > < td > hadoop-2.6< / td > < / tr >
< tr > < td > 2.7.x and later 2.x< / td > < td > hadoop-2.7< / td > < / tr >
2014-05-05 13:33:49 -04:00
< / tbody >
< / table >
2016-11-03 20:27:23 -04:00
Note that support for versions of Hadoop before 2.6 are deprecated as of Spark 2.1.0 and may be
removed in Spark 2.2.0.
2014-04-29 01:50:51 -04:00
2015-09-08 09:38:10 -04:00
You can enable the `yarn` profile and optionally set the `yarn.version` property if it is different from `hadoop.version` . Spark only supports YARN versions 2.2.0 and later.
2014-10-27 13:02:48 -04:00
2014-05-05 13:33:49 -04:00
Examples:
2013-03-17 17:47:44 -04:00
2016-05-17 11:40:38 -04:00
# Apache Hadoop 2.2.X
./build/mvn -Pyarn -Phadoop-2.2 -DskipTests clean package
2015-05-14 10:22:58 -04:00
2016-05-17 11:40:38 -04:00
# Apache Hadoop 2.3.X
./build/mvn -Pyarn -Phadoop-2.3 -Dhadoop.version=2.3.0 -DskipTests clean package
2014-05-05 13:33:49 -04:00
2016-05-17 11:40:38 -04:00
# Apache Hadoop 2.4.X or 2.5.X
2016-10-12 01:31:21 -04:00
./build/mvn -Pyarn -Phadoop-2.4 -Dhadoop.version=2.4.0 -DskipTests clean package
2014-05-05 13:33:49 -04:00
2016-05-17 11:40:38 -04:00
# Apache Hadoop 2.6.X
./build/mvn -Pyarn -Phadoop-2.6 -Dhadoop.version=2.6.0 -DskipTests clean package
2014-11-24 14:28:48 -05:00
2016-05-17 11:40:38 -04:00
# Apache Hadoop 2.7.X and later
2016-10-12 01:31:21 -04:00
./build/mvn -Pyarn -Phadoop-2.7 -Dhadoop.version=2.7.0 -DskipTests clean package
2016-03-19 00:32:48 -04:00
2016-05-17 11:40:38 -04:00
# Different versions of HDFS and YARN.
./build/mvn -Pyarn -Phadoop-2.3 -Dhadoop.version=2.3.0 -Dyarn.version=2.2.0 -DskipTests clean package
2014-04-29 01:50:51 -04:00
2016-05-17 11:40:38 -04:00
## Building With Hive and JDBC Support
2014-05-04 02:32:12 -04:00
2014-08-23 01:28:05 -04:00
To enable Hive integration for Spark SQL along with its JDBC server and CLI,
2014-11-12 00:36:48 -05:00
add the `-Phive` and `Phive-thriftserver` profiles to your existing build options.
2016-03-10 20:07:18 -05:00
By default Spark will build with Hive 1.2.1 bindings.
2016-05-10 13:29:38 -04:00
2016-05-17 11:40:38 -04:00
# Apache Hadoop 2.4.X with Hive 1.2.1 support
./build/mvn -Pyarn -Phadoop-2.4 -Dhadoop.version=2.4.0 -Phive -Phive-thriftserver -DskipTests clean package
2016-05-10 13:29:38 -04:00
2016-05-17 11:40:38 -04:00
## Packaging without Hadoop Dependencies for YARN
2016-05-10 13:29:38 -04:00
2016-08-26 15:25:22 -04:00
The assembly directory produced by `mvn package` will, by default, include all of Spark's
dependencies, including Hadoop and some of its ecosystem projects. On YARN deployments, this
causes multiple versions of these to appear on executor classpaths: the version packaged in
2016-05-17 11:40:38 -04:00
the Spark assembly and the version on each node, included with `yarn.application.classpath` .
2016-08-26 15:25:22 -04:00
The `hadoop-provided` profile builds the assembly without including Hadoop-ecosystem projects,
2016-05-17 11:40:38 -04:00
like ZooKeeper and Hadoop itself.
2014-08-03 13:19:04 -04:00
2016-08-26 15:25:22 -04:00
## Building with Mesos support
./build/mvn -Pmesos -DskipTests clean package
2016-05-17 11:40:38 -04:00
## Building for Scala 2.10
To produce a Spark package compiled with Scala 2.10, use the `-Dscala-2.10` property:
2013-03-17 17:47:44 -04:00
2016-05-17 11:40:38 -04:00
./dev/change-scala-version.sh 2.10
./build/mvn -Pyarn -Phadoop-2.4 -Dscala-2.10 -DskipTests clean package
2016-11-03 20:27:23 -04:00
Note that support for Scala 2.10 is deprecated as of Spark 2.1.0 and may be removed in Spark 2.2.0.
2013-03-17 17:47:44 -04:00
2016-05-17 11:40:38 -04:00
## Building submodules individually
2015-10-08 06:38:39 -04:00
It's possible to build Spark sub-modules using the `mvn -pl` option.
For instance, you can build the Spark Streaming module using:
2016-05-17 11:40:38 -04:00
./build/mvn -pl :spark-streaming_2.11 clean install
2015-10-08 06:38:39 -04:00
2016-03-19 00:32:48 -04:00
where `spark-streaming_2.11` is the `artifactId` as defined in `streaming/pom.xml` file.
2013-03-17 17:47:44 -04:00
2016-05-17 11:40:38 -04:00
## Continuous Compilation
2013-08-21 17:51:56 -04:00
We use the scala-maven-plugin which supports incremental and continuous compilation. E.g.
2016-05-17 11:40:38 -04:00
./build/mvn scala:cc
2013-08-21 17:51:56 -04:00
[SPARK-4501][Core] - Create build/mvn to automatically download maven/zinc/scalac
Creates a top level directory script (as `build/mvn`) to automatically download zinc and the specific version of scala used to easily build spark. This will also download and install maven if the user doesn't already have it and all packages are hosted under the `build/` directory. Tested on both Linux and OSX OS's and both work. All commands pass through to the maven binary so it acts exactly as a traditional maven call would.
Author: Brennon York <brennon.york@capitalone.com>
Closes #3707 from brennonyork/SPARK-4501 and squashes the following commits:
0e5a0e4 [Brennon York] minor incorrect doc verbage (with -> this)
9b79e38 [Brennon York] fixed merge conflicts with dev/run-tests, properly quoted args in sbt/sbt, fixed bug where relative paths would fail if passed in from build/mvn
d2d41b6 [Brennon York] added blurb about leverging zinc with build/mvn
b979c58 [Brennon York] updated the merge conflict
c5634de [Brennon York] updated documentation to overview build/mvn, updated all points where sbt/sbt was referenced with build/sbt
b8437ba [Brennon York] set progress bars for curl and wget when not run on jenkins, no progress bar when run on jenkins, moved sbt script to build/sbt, wrote stub and warning under sbt/sbt which calls build/sbt, modified build/sbt to use the correct directory, fixed bug in build/sbt-launch-lib.bash to correctly pull the sbt version
be11317 [Brennon York] added switch to silence download progress only if AMPLAB_JENKINS is set
28d0a99 [Brennon York] updated to remove the python dependency, uses grep instead
7e785a6 [Brennon York] added silent and quiet flags to curl and wget respectively, added single echo output to denote start of a download if download is needed
14a5da0 [Brennon York] removed unnecessary zinc output on startup
1af4a94 [Brennon York] fixed bug with uppercase vs lowercase variable
3e8b9b3 [Brennon York] updated to properly only restart zinc if it was freshly installed
a680d12 [Brennon York] Added comments to functions and tested various mvn calls
bb8cc9d [Brennon York] removed package files
ef017e6 [Brennon York] removed OS complexities, setup generic install_app call, removed extra file complexities, removed help, removed forced install (defaults now), removed double-dash from cli
07bf018 [Brennon York] Updated to specifically handle pulling down the correct scala version
f914dea [Brennon York] Beginning final portions of localized scala home
69c4e44 [Brennon York] working linux and osx installers for purely local mvn build
4a1609c [Brennon York] finalizing working linux install for maven to local ./build/apache-maven folder
cbfcc68 [Brennon York] Changed the default sbt/sbt to build/sbt and added a build/mvn which will automatically download, install, and execute maven with zinc for easier build capability
2014-12-27 16:25:18 -05:00
should run continuous compilation (i.e. wait for changes). However, this has not been tested
2014-12-15 17:52:17 -05:00
extensively. A couple of gotchas to note:
2015-02-03 00:14:21 -05:00
2014-12-15 17:52:17 -05:00
* it only scans the paths `src/main` and `src/test` (see
[docs ](http://scala-tools.org/mvnsites/maven-scala-plugin/usage_cc.html )), so it will only work
from within certain submodules that have that structure.
2015-02-03 00:14:21 -05:00
2014-12-15 17:52:17 -05:00
* you'll typically need to run `mvn install` from the project root for compilation within
specific submodules to work; this is because submodules that depend on other submodules do so via
the `spark-parent` module).
Thus, the full flow for running continuous-compilation of the `core` submodule may look more like:
2015-02-03 00:14:21 -05:00
2016-05-17 11:40:38 -04:00
$ ./build/mvn install
2015-09-08 09:38:10 -04:00
$ cd core
2016-05-17 11:40:38 -04:00
$ ../build/mvn scala:cc
2013-08-21 17:51:56 -04:00
2016-05-17 11:40:38 -04:00
## Speeding up Compilation with Zinc
2013-03-17 17:47:44 -04:00
2016-05-17 11:40:38 -04:00
[Zinc ](https://github.com/typesafehub/zinc ) is a long-running server version of SBT's incremental
compiler. When run locally as a background process, it speeds up builds of Scala-based projects
like Spark. Developers who regularly recompile Spark with Maven will be the most interested in
Zinc. The project site gives instructions for building and running `zinc` ; OS X users can
install it using `brew install zinc` .
2013-03-17 17:47:44 -04:00
2016-05-17 11:40:38 -04:00
If using the `build/mvn` package `zinc` will automatically be downloaded and leveraged for all
builds. This process will auto-start after the first time `build/mvn` is called and bind to port
3030 unless the `ZINC_PORT` environment variable is set. The `zinc` process can subsequently be
shut down at any time by running `build/zinc-<version>/bin/zinc -shutdown` and will automatically
restart whenever `build/mvn` is called.
2014-03-04 01:31:30 -05:00
2016-05-17 11:40:38 -04:00
## Building with SBT
2014-03-04 01:31:30 -05:00
2016-05-17 11:40:38 -04:00
Maven is the official build tool recommended for packaging Spark, and is the *build of reference* .
But SBT is supported for day-to-day development since it can provide much faster iterative
compilation. More advanced developers may wish to use SBT.
[SPARK-4501][Core] - Create build/mvn to automatically download maven/zinc/scalac
Creates a top level directory script (as `build/mvn`) to automatically download zinc and the specific version of scala used to easily build spark. This will also download and install maven if the user doesn't already have it and all packages are hosted under the `build/` directory. Tested on both Linux and OSX OS's and both work. All commands pass through to the maven binary so it acts exactly as a traditional maven call would.
Author: Brennon York <brennon.york@capitalone.com>
Closes #3707 from brennonyork/SPARK-4501 and squashes the following commits:
0e5a0e4 [Brennon York] minor incorrect doc verbage (with -> this)
9b79e38 [Brennon York] fixed merge conflicts with dev/run-tests, properly quoted args in sbt/sbt, fixed bug where relative paths would fail if passed in from build/mvn
d2d41b6 [Brennon York] added blurb about leverging zinc with build/mvn
b979c58 [Brennon York] updated the merge conflict
c5634de [Brennon York] updated documentation to overview build/mvn, updated all points where sbt/sbt was referenced with build/sbt
b8437ba [Brennon York] set progress bars for curl and wget when not run on jenkins, no progress bar when run on jenkins, moved sbt script to build/sbt, wrote stub and warning under sbt/sbt which calls build/sbt, modified build/sbt to use the correct directory, fixed bug in build/sbt-launch-lib.bash to correctly pull the sbt version
be11317 [Brennon York] added switch to silence download progress only if AMPLAB_JENKINS is set
28d0a99 [Brennon York] updated to remove the python dependency, uses grep instead
7e785a6 [Brennon York] added silent and quiet flags to curl and wget respectively, added single echo output to denote start of a download if download is needed
14a5da0 [Brennon York] removed unnecessary zinc output on startup
1af4a94 [Brennon York] fixed bug with uppercase vs lowercase variable
3e8b9b3 [Brennon York] updated to properly only restart zinc if it was freshly installed
a680d12 [Brennon York] Added comments to functions and tested various mvn calls
bb8cc9d [Brennon York] removed package files
ef017e6 [Brennon York] removed OS complexities, setup generic install_app call, removed extra file complexities, removed help, removed forced install (defaults now), removed double-dash from cli
07bf018 [Brennon York] Updated to specifically handle pulling down the correct scala version
f914dea [Brennon York] Beginning final portions of localized scala home
69c4e44 [Brennon York] working linux and osx installers for purely local mvn build
4a1609c [Brennon York] finalizing working linux install for maven to local ./build/apache-maven folder
cbfcc68 [Brennon York] Changed the default sbt/sbt to build/sbt and added a build/mvn which will automatically download, install, and execute maven with zinc for easier build capability
2014-12-27 16:25:18 -05:00
2016-05-17 11:40:38 -04:00
The SBT build is derived from the Maven POM files, and so the same Maven profiles and variables
can be set to control the SBT build. For example:
2015-11-11 14:16:39 -05:00
2016-05-17 11:40:38 -04:00
./build/sbt -Pyarn -Phadoop-2.3 package
2015-11-11 14:16:39 -05:00
2016-05-17 11:40:38 -04:00
To avoid the overhead of launching sbt each time you need to re-compile, you can launch sbt
in interactive mode by running `build/sbt` , and then run all build commands at the command
prompt. For more recommendations on reducing build time, refer to the
[wiki page ](https://cwiki.apache.org/confluence/display/SPARK/Useful+Developer+Tools#UsefulDeveloperTools-ReducingBuildTimes ).
2014-03-12 01:39:17 -04:00
2016-05-17 11:40:38 -04:00
## Encrypted Filesystems
2016-05-06 07:25:45 -04:00
2016-05-17 11:40:38 -04:00
When building on an encrypted filesystem (if your home directory is encrypted, for example), then the Spark build might fail with a "Filename too long" error. As a workaround, add the following in the configuration args of the `scala-maven-plugin` in the project `pom.xml` :
2016-05-06 07:25:45 -04:00
2016-05-17 11:40:38 -04:00
< arg > -Xmax-classfile-name< / arg >
< arg > 128< / arg >
2016-05-06 07:25:45 -04:00
2016-05-17 11:40:38 -04:00
and in `project/SparkBuild.scala` add:
2016-05-06 07:25:45 -04:00
2016-05-17 11:40:38 -04:00
scalacOptions in Compile ++= Seq("-Xmax-classfile-name", "128"),
2016-05-06 07:25:45 -04:00
2016-05-17 11:40:38 -04:00
to the `sharedSettings` val. See also [this PR ](https://github.com/apache/spark/pull/2883/files ) if you are unsure of where to add these lines.
2016-05-06 07:25:45 -04:00
2016-05-17 11:40:38 -04:00
## IntelliJ IDEA or Eclipse
2014-03-12 01:39:17 -04:00
2016-05-17 11:40:38 -04:00
For help in setting up IntelliJ IDEA or Eclipse for Spark development, and troubleshooting, refer to the
[wiki page for IDE setup ](https://cwiki.apache.org/confluence/display/SPARK/Useful+Developer+Tools#UsefulDeveloperTools-IDESetup ).
2014-03-12 01:39:17 -04:00
2016-05-17 11:40:38 -04:00
# Running Tests
2014-09-16 12:18:03 -04:00
2016-05-17 11:40:38 -04:00
Tests are run by default via the [ScalaTest Maven plugin ](http://www.scalatest.org/user_guide/using_the_scalatest_maven_plugin ).
2016-09-29 19:01:45 -04:00
Note that tests should not be run as root or an admin user.
2014-09-16 12:18:03 -04:00
2016-10-20 18:30:01 -04:00
The following is an example of a command to run the tests:
2014-09-16 12:18:03 -04:00
2016-05-17 11:40:38 -04:00
./build/mvn -Pyarn -Phadoop-2.3 -Phive -Phive-thriftserver test
The ScalaTest plugin also supports running only a specific Scala test suite as follows:
./build/mvn -P... -Dtest=none -DwildcardSuites=org.apache.spark.repl.ReplSuite test
./build/mvn -P... -Dtest=none -DwildcardSuites=org.apache.spark.repl.* test
or a Java test:
2015-10-12 17:23:29 -04:00
2016-05-17 11:40:38 -04:00
./build/mvn test -P... -DwildcardSuites=none -Dtest=org.apache.spark.streaming.JavaAPISuite
## Testing with SBT
2014-10-06 00:36:20 -04:00
2016-10-20 18:30:01 -04:00
The following is an example of a command to run the tests:
2014-10-06 00:36:20 -04:00
2016-05-17 11:40:38 -04:00
./build/sbt -Pyarn -Phadoop-2.3 -Phive -Phive-thriftserver test
2014-10-06 00:36:20 -04:00
To run only a specific test suite as follows:
2016-05-17 11:40:38 -04:00
./build/sbt -Pyarn -Phadoop-2.3 -Phive -Phive-thriftserver "test-only org.apache.spark.repl.ReplSuite"
./build/sbt -Pyarn -Phadoop-2.3 -Phive -Phive-thriftserver "test-only org.apache.spark.repl.*"
2014-10-06 00:36:20 -04:00
To run test suites of a specific sub project as follows:
2016-05-17 11:40:38 -04:00
./build/sbt -Pyarn -Phadoop-2.3 -Phive -Phive-thriftserver core/test
2014-10-06 00:36:20 -04:00
2016-05-17 11:40:38 -04:00
## Running Java 8 Test Suites
2014-09-16 12:18:03 -04:00
2016-05-17 11:40:38 -04:00
Running only Java 8 tests and nothing else.
[SPARK-4501][Core] - Create build/mvn to automatically download maven/zinc/scalac
Creates a top level directory script (as `build/mvn`) to automatically download zinc and the specific version of scala used to easily build spark. This will also download and install maven if the user doesn't already have it and all packages are hosted under the `build/` directory. Tested on both Linux and OSX OS's and both work. All commands pass through to the maven binary so it acts exactly as a traditional maven call would.
Author: Brennon York <brennon.york@capitalone.com>
Closes #3707 from brennonyork/SPARK-4501 and squashes the following commits:
0e5a0e4 [Brennon York] minor incorrect doc verbage (with -> this)
9b79e38 [Brennon York] fixed merge conflicts with dev/run-tests, properly quoted args in sbt/sbt, fixed bug where relative paths would fail if passed in from build/mvn
d2d41b6 [Brennon York] added blurb about leverging zinc with build/mvn
b979c58 [Brennon York] updated the merge conflict
c5634de [Brennon York] updated documentation to overview build/mvn, updated all points where sbt/sbt was referenced with build/sbt
b8437ba [Brennon York] set progress bars for curl and wget when not run on jenkins, no progress bar when run on jenkins, moved sbt script to build/sbt, wrote stub and warning under sbt/sbt which calls build/sbt, modified build/sbt to use the correct directory, fixed bug in build/sbt-launch-lib.bash to correctly pull the sbt version
be11317 [Brennon York] added switch to silence download progress only if AMPLAB_JENKINS is set
28d0a99 [Brennon York] updated to remove the python dependency, uses grep instead
7e785a6 [Brennon York] added silent and quiet flags to curl and wget respectively, added single echo output to denote start of a download if download is needed
14a5da0 [Brennon York] removed unnecessary zinc output on startup
1af4a94 [Brennon York] fixed bug with uppercase vs lowercase variable
3e8b9b3 [Brennon York] updated to properly only restart zinc if it was freshly installed
a680d12 [Brennon York] Added comments to functions and tested various mvn calls
bb8cc9d [Brennon York] removed package files
ef017e6 [Brennon York] removed OS complexities, setup generic install_app call, removed extra file complexities, removed help, removed forced install (defaults now), removed double-dash from cli
07bf018 [Brennon York] Updated to specifically handle pulling down the correct scala version
f914dea [Brennon York] Beginning final portions of localized scala home
69c4e44 [Brennon York] working linux and osx installers for purely local mvn build
4a1609c [Brennon York] finalizing working linux install for maven to local ./build/apache-maven folder
cbfcc68 [Brennon York] Changed the default sbt/sbt to build/sbt and added a build/mvn which will automatically download, install, and execute maven with zinc for easier build capability
2014-12-27 16:25:18 -05:00
2016-05-17 11:40:38 -04:00
./build/mvn install -DskipTests
./build/mvn -pl :java8-tests_2.11 test
or
./build/sbt java8-tests/test
Java 8 tests are automatically enabled when a Java 8 JDK is detected.
If you have JDK 8 installed but it is not the system default, you can set JAVA_HOME to point to JDK 8 before running the tests.
## PySpark Tests with Maven
If you are building PySpark and wish to run the PySpark tests you will need to build Spark with Hive support.
./build/mvn -DskipTests clean package -Phive
./python/run-tests
The run-tests script also can be limited to a specific Python version or a specific module
./python/run-tests --python-executables=python --modules=pyspark-sql
**Note:** You can also run Python tests with an sbt build, provided you build Spark with Hive support.
## Running R Tests
2016-08-26 15:25:22 -04:00
To run the SparkR tests you will need to install the R package `testthat`
(run `install.packages(testthat)` from R shell). You can run just the SparkR tests using
2016-05-17 11:40:38 -04:00
the command:
./R/run-tests.sh
## Running Docker-based Integration Test Suites
2016-08-26 15:25:22 -04:00
In order to run Docker integration tests, you have to install the `docker` engine on your box.
The instructions for installation can be found at [the Docker site ](https://docs.docker.com/engine/installation/ ).
Once installed, the `docker` service needs to be started, if not already running.
2016-05-17 11:40:38 -04:00
On Linux, this can be done by `sudo service docker start` .
./build/mvn install -DskipTests
./build/mvn -Pdocker-integration-tests -pl :spark-docker-integration-tests_2.11
or
./build/sbt docker-integration-tests/test