top of page

Maven Java Project with Spark

  • Create New Maven Project.

  • Add the following to POM.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.spark.example</groupId>
  <artifactId>SparkSimpleApp</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
	  <dependency>
			<groupId>com.sparkjava</groupId>
			<artifactId>spark-core</artifactId>
			<version>2.9.3</version>
		</dependency>
		<dependency>
			<groupId>org.apache.spark</groupId>
			<artifactId>spark-sql_2.12</artifactId>
			<version>2.4.0</version>
	  </dependency>
  </dependencies>
</project>
  • Add Congifuration log4j files

    • log4j2.xml - /src/main/resources

    • log4j.properties

import org.apache.log4j.BasicConfigurator;
public static void main(String[] args) {
    	
    	BasicConfigurator.configure();
    	
        get("/hello", (req, res) -> "Hello World");
    }

Dependecy for MySQL in Maven Project

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.39</version>
</dependency>
 
 
 

Recent Posts

See All
Harbor Install & Setup

1. Go to the Harbor releases page & Download either the online or offline installer for the version you want to install. 2. Use tar to...

 
 
 

Comments


Contact Me

Tel: 678-642-8051

cspeed@jcsassoc.com

  • Google+ Long Shadow
  • LinkedIn Long Shadow
  • Facebook Social Icon
  • Twitter Long Shadow

© 2005 by Christopher Speed

Your details were sent successfully!

bottom of page