0

Here's the background:

I am a newbie to both Java and Eclipse. I am trying to write a Map-Reduce program. I am following Tom White's book: Hadoop - The definitive guide

The problem:

Have installed Hadoop from http://hadoop.apache.org/ as explained in Appendix A of the book. I was trying the code in Chapter 2 on weather dataset. This is where I got the compile error.

I created a project and put the three codes in Eclipse IDE:

a) MaxTemperature.java
b) MaxTemperatureMapper.java
c) MaxTemperatureReducer.java

I tried to understand the suggestions in:

How to import org.apache Java dependencies w/ or w/o Maven (Raul Rene's)

The import org.junit cannot be resolved

I understood that using Maven will resolve my problem. But I couldn't understand how to resolve my problem.

This is what I did: a) installed Maven b) Right Click on project in the package section -> Configure -> Convert to Maven Project

I noticed that this created pom.xml but couldn't figure out how to resolve my issue. Please help me out.

Thanks in advance.

Community
  • 1
  • 1
Kaushik Acharya
  • 1,520
  • 2
  • 16
  • 25

2 Answers2

0

Having installed and created a POM file is good. But it does not help to resolve the import becaus you haven't tell maven where to find the import.

Add to your pom:

<dependencies>
  <dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-core</artifactId>
    <version>1.2.1</version>
 </dependency>
</dependencies>
xsenechal
  • 349
  • 1
  • 4
0

If you already have it as a maven project, and the pom.xml generated is functional, you will need to add a dependency to your maven project on the org.apache library. To do so:

  1. Open pom.xml
  2. Go to 'dependencies' tab
  3. Click add

There you should be able to add the dependencies to your project. If you provide the compile error, or the exact libraries you need, I can help further with adding the dependency.

Amr
  • 2,420
  • 2
  • 17
  • 26