I’m reading “Mahout in Action” MEAP Edition, but it doesn’t teach how to construct a development environment of Mahout…
So I wrote the way of that by testing sample codes of “Mahout in Action”.
I examine based on Windows 2008 x64.
Install several packages.
- Java SDK 6u23 x64
- Eclipse 3.6(helios) SR1 x64
- Maven 3.0.2
- (Hadoop 0.21.0)
Hadoop is not used in this article.
I am not good at Maven… So I’ve read the following documents.
Maven 3 has “Maven 2 Repository”!😛
Source of Mahout
Use not the binary but the source code of Mahout, because reference them in Eclipse.
I used Mahout 0.4, but 0.5 SNAPSHOT may be better since Mahout’s API is fluid.
At first, start Eclipse and create a workspace. We take it “C:\Users\shuyo\workspace” for the present.
Extract the source of Mahout below the workspace. It is “C:\Users\shuyo\workspace\mahout-distribution-0.4” for the present.
Convert Maven project of Mahout into Eclipse project with the below command.
cd C:\Users\shuyo\workspace\mahout-distribution-0.4 mvn eclipse:eclipse
Now set the classpath variable M2_REPO of Eclipse to Maven 2 local repository.
mvn -Declipse.workspace= eclipse:add-maven-repo
But “Maven – Guide to using Eclipse with Maven 2.x” says “Issue: The command does not work”. So set it in Eclipse directly.
- Open Window > Preferences > Java > Build Path > Classpath Valirables from Eclipse’s menu.
- Press “New” and Add Name as “M2_REPO” and Path as Maven 2 repository path (its default is .m2/repository at your user directory).
When M2_REPO doesn’t be set, the following errors are thrown.
The project cannot be built until build path errors are resolved Unbound classpath variable: 'M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar' in project '********'
Finally import the converted Eclipse project of Mahout.
- Open File > Import > General > Existing Projects into Workspace from Eclipse menu.
- Select the project directory C:\Users\shuyo\workspace\mahout-distribution-0.4 and all projects.
Continued on the next post.