- This is a template is a Scala project for Hadoop, Hive and Spark using Maven.
- When using this template, make sure to change the
artifactId,groupIdandnamein the pom.xml file to your own. - Also make sure the change the directory structure inside
src/main/scalato your own package structure. - If you have a single main class for your built jar, you can set the
mainClasstag in properties.
mvn clean installmvn spotless:applymvn scalafix:scalafix -Dscalafix.mode=IN_PLACEmvn testmvn scala:runmvn versions:display-dependency-updatesmvn versions:display-plugin-updates<properties>
<!-- Set specific maven version for this project to build -->
<enforce.mvn.version>3.9.9</enforce.mvn.version>
<!-- Set specific jdk version for this project to build -->
<enforce.jdk.version>17</enforce.jdk.version>
<!-- Source java version for the maven compiler plugin -->
<maven.compiler.source>8</maven.compiler.source>
<!-- Target java version for the maven compiler plugin -->
<maven.compiler.target>8</maven.compiler.target>
<!-- Project build encoding format -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Scala version -->
<scala.version>2.12.20</scala.version>
<!-- Scala compat short version -->
<scala.compat.version>2.12</scala.compat.version>
<!-- Spark version -->
<spark.version>3.5.5</spark.version>
<!-- Hadoop version -->
<hadoop.version>3.4.1</hadoop.version>
<!-- Hive version -->
<hive.version>4.0.1</hive.version>
<!-- Main class of the jar to execute -->
<mainClass>example.Hello</mainClass>
</properties>Important
Try to reuse the properties declared in various places in pom.xml by invoking in the following manner ${your-property-tag-name}.
For example, to use scala.compat.version property invoke it in the following manner ${scala.compat.version}.
Tip
You can enforce the java version and maven version by setting the properties enforce.jdk.version and enforce.mvn.version respectively.
This will ensure that the project is built with the specified version of java and maven.