Hadoop requires a lot of jars. Sometimes, we don’t know which jar should we include. It took me for a very long time. IĀ got bored of it. Finally, I found the maven, it can build the hadoop environment easily and fast. Here we go:
1. Create a Maven project
2. Open the pom.xml, put the following code into the <dependencies> part.
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>2.3.0</version>
</dependency>
3. Save the pom.xml. While it is saving, you can see Myeclipse is building the workspace. It may probably download jar
files online.
4. After the building workspace is done, you can see necessary jars are prepared automatically by maven in “MavenĀ Dependencies”.