spark-app-build
Building Spark applications thru Build Tools |
|---|
|
Building Jars thru tools like sbt & mill |
|
1. Create Scala project in IntelliJ File > New Project > Scala
|
2. This will generate a Scala project structure
|
| 3. Create a folder structure in src/main/scala like com.test.sparkeg1 |
4. Create a Scala object in sparkeg1 package.
|
5. Edit build.sbt config
|
|
6. Right click on Project, spark-eg > Module settings > Platform settings > Global libraries Add Scala library 2.12.13 if not mentioned. |
|
7. For more SBT settings File > Settings > Build, Execution, Deployment > Build Tools > sbt |
|
8. Build Project, we can find the snapshot jar in the target > scala 2.12 > spark-eg_2.12_0.1.0.jar Alternatively we can find one more jar in module specific folder in the project structure > target > scala-2.12 > sparkeg1_2.12-0.1.0-SNAPSHOT.jar |
| 9. Alternatively we can find sbt shell cli, we can compile, build and run jar from it. |
|
10. sbt cli commands: clean - deletes the classes directory compile - compiles the source files package - builds jar file run - run the jar file |
| 11. We can add more modules (right click on project root > New > Module) and can have separate build file(build.sbt) per module. |
12. Project structure after building app from sbt.
|
Comments
Post a Comment