Skip to content

Instantly share code, notes, and snippets.

@jimbaker
Created August 19, 2015 22:30
Show Gist options
  • Save jimbaker/ecf989f225c7ef50e2ba to your computer and use it in GitHub Desktop.
Save jimbaker/ecf989f225c7ef50e2ba to your computer and use it in GitHub Desktop.
Gradle build script for Spark. Just enough integration to do something interesting - IntelliJ, shading, unit testing with Scala test, interop with Twilio SDK - without attempting to download the internet.
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '1.2.2'
}
apply plugin: 'idea'
apply plugin: 'scala'
apply plugin: 'com.github.johnrengelman.shadow'
version = 0.1
repositories {
mavenCentral()
}
configurations {
provided
}
sourceSets {
main {
compileClasspath += configurations.provided
}
}
dependencies {
provided group: 'org.apache.spark', name: 'spark-core_2.10', version: '1.4.1' // NB 2.10 is the Scala version
compile 'org.scala-lang:scala-library:2.10.4'
compile group: 'org.jpmml', name: 'pmml-evaluator', version: '1.2.3'
compile 'com.twilio.sdk:twilio-java-sdk:3.4.5'
testCompile group: 'org.apache.spark', name: 'spark-core_2.10', version: '1.4.1' // NB 2.10 is the Scala version
testCompile 'com.holdenkarau:spark-testing-base_2.10:1.3.0_1.1.1_0.0.6'
testCompile 'org.scalatest:scalatest_2.10:2.2.4'
testCompile 'org.scalacheck:scalacheck_2.10:1.12.4'
}
shadowJar {
dependencies {
include(dependency('com.twilio.sdk:.*'))
}
}
idea {
module {
// IntelliJ does not know about the standard idiom of provided as used in managing
// uber/shaded jar dependencies. Make it so!
scopes.PROVIDED.plus += [ configurations.provided ]
}
}
task spec(dependsOn: ['testClasses'], type: JavaExec) {
main = 'org.scalatest.tools.Runner'
args = ['-R', 'build/classes/test', '-o']
classpath = sourceSets.test.runtimeClasspath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment