Why do we need to compile the source code? In fact, it is easier to directly use a binary package to read and modify the source code.
1. use MVN install directly in the mahout installation directory, so that all files under the mahout directory are compiled and packaged for installation, you can view the class directory and the generated jar package in the target directory of each module.
2. if you only want to compile the part, for example, compile core: change to the core directory, MVN compile. At this time, no jar package is generated and only the jar package is generated. class file, then the MVN package can generate a jar package in the current directory, and then install jar in the MVN install local repository
3. After MVN clean is executed, the target directory is deleted, and the corresponding jar package is retained in the local repository.
4. At this time, the compiled mahout cannot be directly exported to the Eclipse project, download the m2eclipse plug-in, create a Maven project, and then select the jar package in repository in POM. XML to import it.
How to export the mahout source code to eclipse
Method 1:
1. install the m2eclipse plug-in, plug-in-export-> Import-> Maven-> existing Maven projects, and then select the module to be imported. After compilation, you can see that the classes directory is added to the target directory of each module directory under the mahout installation directory. after the Java source file is compiled and generated. class
Method 2:
The m2eclipse plug-in does not need to be installed in this method.
1. In the mahout installation directory, use MVN Eclipse: Eclipse. At this time, the eclipse associated file has been generated.
2. if mahout is not compiled, that is, the local repository does not have a jar package for mahout, use MVN-declipse In the mahout source code directory. workspace = Eclipse: Add-Maven-Repo. If the repository has a jar package, this step is saved.
3. open eclipse and import various projects in mahout. If an error is reported, the system prompts that the m2_repo variable is missing, in eclipse, open window> preferences> JAVA> build path> classpath valirables-> "new" and add name as "m2_repo" and path as Maven 2 repository path. For details, see references.
I use the first method to compile the mahout source code in windows, and the second method to compile the mahout source code in Ubuntu.
References:
1. http://hi.baidu.com/pakko/blog/item/a957f4c23af3c50e0ff477a1.html
2. http://shuyo.wordpress.com/2011/02/01/mahout-development-environment-with-maven-and-eclipse-1/3.http://maven.apache.org/guides/mini/guide-ide-eclipse.html4.http://www.cnblogs.com/phoebus0501/archive/2011/05/10/2042511.html5.https://cwiki.apache.org/confluence/display/MAHOUT/BuildingMahout