Skip to content

Commit 2d8039b

Browse files
committed
A Spark bootstrap project written in Scala with gradle as build tool.
1 parent 24c5c24 commit 2d8039b

File tree

3,106 files changed

+199532
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,106 files changed

+199532
-2
lines changed

.gitignore

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# IntelliJ
2+
.idea
3+
*.iml
4+
*.ipr
5+
*.iws
6+
out
7+
# sbt-idea plugin
8+
.idea_modules/
9+
10+
# scala fmt
11+
.scalafmt.conf
12+
13+
# Ignore Gradle project-specific cache directory
14+
.gradle
15+
16+
# local file to ignore
17+
local
18+
plugin
19+
.gitlab-ci.yml
20+
# ignore build directory
21+
build
22+
23+
#hive
24+
derby.log
25+
metastore_db
26+
27+
### Java template
28+
*.class
29+
30+
# Package Files #
31+
*.jar
32+
*.war
33+
*.ear
34+
35+
#
36+
.git-jwn
37+
Notes
38+
39+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
40+
hs_err_pid*
41+
### Emacs template
42+
# -*- mode: gitignore; -*-
43+
\#*\#
44+
/.emacs.desktop
45+
/.emacs.desktop.lock
46+
*.elc
47+
auto-save-list
48+
tramp
49+
.\#*

README.md

+44-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,44 @@
1-
# spark-scala-gradle-bootstrap
2-
# spark-scala-gradle-bootstrap
1+
# _spark-scala-gradle-bootstrap_
2+
3+
A Spark bootstrap project written in Scala with gradle as build tool.
4+
5+
## Prerequisites
6+
7+
- [Java](https://java.com/en/download/)
8+
- [Gradle](https://gradle.org/)
9+
- [Scala](https://www.scala-lang.org/)
10+
11+
### Build
12+
13+
`./gradlew clean build`
14+
15+
### Coverage
16+
17+
https://github.com/scoverage/gradle-scoverage
18+
19+
## Functional Test Examples
20+
21+
https://github.com/scoverage/gradle-scoverage/blob/master/build.gradle
22+
23+
## Libraries Included
24+
25+
- Spark - 3.4.1
26+
27+
## Useful Links
28+
29+
- [Spark Docs - Root Page](http://spark.apache.org/docs/latest/)
30+
- [Spark Programming Guide](http://spark.apache.org/docs/latest/programming-guide.html)
31+
- [Spark Latest API docs](http://spark.apache.org/docs/latest/api/)
32+
- [Scala API Docs](http://www.scala-lang.org/api/2.12.1/scala/)
33+
- https://barrelsofdata.com/spark-boilerplate-using-scala
34+
35+
## Issues or Suggestions
36+
37+
# Learn Spark
38+
39+
https://www.databricks.com/wp-content/uploads/2021/06/Ebook_8-Steps-V2.pdf
40+
41+
# References
42+
43+
https://github.com/spark-examples/spark-scala-examples
44+
> > > > > > > 002f78d (A Spark bootstrap project written in Scala with gradle as build tool.)

build.gradle

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
//buildscript {
2+
// repositories {
3+
// mavenCentral()
4+
// }
5+
//}
6+
plugins {
7+
id 'scala'
8+
id 'application'
9+
id "com.github.spotbugs-base"
10+
id "com.diffplug.spotless"
11+
id 'net.nemerosa.versioning'
12+
id 'com.jfrog.artifactory'
13+
id 'org.scoverage'
14+
id 'template.spark.livyPlugin'
15+
}
16+
17+
//apply plugin: LivyPlugin
18+
apply plugin: 'java'
19+
apply plugin: 'scala'
20+
apply plugin: 'idea'
21+
apply plugin: 'maven-publish'
22+
apply from: "$rootDir/gradle/artifactory.gradle"
23+
apply from: "$rootDir/gradle/checkstyle.gradle"
24+
apply from: "$rootDir/gradle/spotless.gradle"
25+
apply from: "$rootDir/gradle/scoverage.gradle"
26+
27+
group group
28+
version version
29+
30+
sourceCompatibility = JavaVersion.VERSION_1_8
31+
targetCompatibility = JavaVersion.VERSION_1_8
32+
33+
configurations {
34+
provided
35+
}
36+
37+
sourceSets {
38+
main {
39+
compileClasspath += configurations.provided
40+
}
41+
}
42+
43+
application {
44+
mainClassName = 'dev.template.spark.Main'
45+
}
46+
47+
48+
repositories {
49+
mavenCentral()
50+
}
51+
52+
dependencies {
53+
implementation "org.scalameta:scalafmt-core_${scalaVersion}:${scalafmt}"
54+
implementation "org.apache.spark:spark-sql_${scalaVersion}:${sparkVersion}"
55+
implementation "org.apache.spark:spark-graphx_${scalaVersion}:${sparkVersion}"
56+
implementation "org.apache.spark:spark-launcher_${scalaVersion}:${sparkVersion}"
57+
implementation "org.apache.spark:spark-catalyst_${scalaVersion}:${sparkVersion}"
58+
implementation "org.apache.spark:spark-streaming_${scalaVersion}:${sparkVersion}"
59+
implementation "org.apache.spark:spark-core_${scalaVersion}:${sparkVersion}"
60+
implementation "commons-io:commons-io:${commonsIO}"
61+
62+
implementation "org.apache.hadoop:hadoop-aws:${hadoopAWS}"
63+
implementation "org.apache.spark:spark-hive_${scalaVersion}:${sparkVersion}"
64+
implementation "io.delta:delta-core_${scalaVersion}:${deltaVersion}"
65+
implementation "com.google.guava:guava:31.1-jre"
66+
compileOnly "org.scala-lang:scala-library:$scalaVersion"
67+
compileOnly "org.scala-lang:scala-compiler:${scalaVersion}"
68+
69+
testImplementation "org.scalatestplus:junit-4-13_${scalaVersion}:3.2.2.0"
70+
testImplementation "junit:junit:${junitVersion}"
71+
testRuntimeOnly "org.scala-lang.modules:scala-xml_${scalaVersion}:1.2.0"
72+
testImplementation 'org.mockito:mockito-core:5.3.1'
73+
74+
testImplementation "org.junit.jupiter:junit-jupiter-api:${jupiterApi}"
75+
testImplementation "org.scalatest:scalatest_${scalaVersion}:${scalaTests}"
76+
}
77+
78+
79+
jar {
80+
classifier 'all'
81+
manifest {
82+
attributes 'Implementation-Title': title,
83+
'Implementation-Version': archiveVersion,
84+
'Main-Class': mainClassFile
85+
}
86+
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
87+
from files(sourceSets.main.output.classesDirs)
88+
zip64 true
89+
}
90+
91+
92+
tasks.register('scalaTest', JavaExec) {
93+
dependsOn['testClasses']
94+
mainClass.set("org.scalatest.tools.Runner")
95+
args = ['-R', 'build/classes/scala/test', '-o']
96+
classpath = sourceSets.test.runtimeClasspath
97+
}
98+
99+
test.dependsOn scalaTest
100+
101+
idea {
102+
module {
103+
// IntelliJ does not know about the standard idiom of provided as used in managing
104+
// uber/shaded jar dependencies. Make it so!
105+
scopes.PROVIDED.plus += [configurations.provided]
106+
}
107+
}
108+
109+
def runLivy = tasks.register("runLivy", template.spark.Publish) {
110+
def avscTree = project.fileTree(allAvscs)
111+
112+
targetFiles.from(avscTree)
113+
schemaFile.value(layout.projectDirectory.file("validator/avro-schema.json"))
114+
}
115+

0 commit comments

Comments
 (0)