- Spark Cookbook
- Rishi Yadav
- 386字
- 2021-07-16 13:44:00
Developing Spark applications in Eclipse with Maven
Maven as a build tool has become the de-facto standard over the years. It's not surprising if we look little deeper into the promise Maven brings. Maven has two primary features and they are:
- Convention over configuration: Build tools prior to Maven gave developers freedom about where to put source files, where to put test files, where to put compiled files, and so on. Maven takes away that freedom. With this freedom, all the confusion about locations also goes. In Maven, there is a specific directory structure for everything. The following table shows a few of the most common locations:
In pom.xml
(the configuration file that tells Maven all the information about a project), dependencies are declared in the form of these three coordinates. There is no need to search over the Internet and download, unpack, and copy libraries. All you need to do is to provide three coordinates of the dependency JAR you need and Maven will do the rest for you. The following is an example of using a JUnit dependency:
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency>
This makes dependency management including transitive dependencies very easy. Build tools that came after Maven such as SBT and Gradle also follow these two rules as-is and provide enhancements in other aspects.
Getting ready
From this recipe onwards, this chapter assumes you have installed Eclipse. Please visit http://www.eclipse.org for details.
How to do it...
Let's see how to install the Maven plugin for Eclipse:
- Open Eclipse and navigate to Help | Install New Software.
- Click on the Work with drop-down menu.
- Select the <eclipse version> update site.
- Click on Collaboration tools.
- Check Maven's integration with Eclipse, as in the following screenshot:
- Click on Next and then click on Finish.
There will be a prompt to restart Eclipse and Maven will be installed after the restart.
Now let's see how we can install the Scala plugin for Eclipse:
- Open Eclipse and navigate to Help | Install New Software.
- Click on the Work with drop-down menu.
- Select the <eclipse version> update site.
- Type
http://download.scala-ide.org/sdk/helium/e38/scala210/stable/site
. - Press Enter.
- Select Scala IDE for Eclipse:
- Click on Next and then click on Finish. You will be prompted to restart Eclipse and Scala will be installed after the restart.
- Navigate to Window | Open Perspective | Scala.
Eclipse is now ready for Scala development!
- 數(shù)據(jù)庫系統(tǒng)原理及MySQL應(yīng)用教程(第2版)
- PHP+MySQL網(wǎng)站開發(fā)技術(shù)項(xiàng)目式教程(第2版)
- Magento 2 Development Cookbook
- 匯編語言程序設(shè)計(jì)(第2版)
- 程序員考試案例梳理、真題透解與強(qiáng)化訓(xùn)練
- MariaDB High Performance
- Learn Swift by Building Applications
- 零基礎(chǔ)學(xué)Java程序設(shè)計(jì)
- Java軟件開發(fā)基礎(chǔ)
- HTML5+CSS3+JavaScript Web開發(fā)案例教程(在線實(shí)訓(xùn)版)
- 好好學(xué)Java:從零基礎(chǔ)到項(xiàng)目實(shí)戰(zhàn)
- Machine Learning With Go
- 大學(xué)計(jì)算機(jī)基礎(chǔ)實(shí)驗(yàn)指導(dǎo)
- Android Game Programming by Example
- Julia數(shù)據(jù)科學(xué)應(yīng)用