It took a night to get the Hadoop build environment, and there were some errors that were saved here.
Need to compile Hadoop, not only to install MAVEN, but also to install protobuf
Installing MAVEN
- Download: apache-maven-3.0.5-bin.tar.gz
- Decompression: TAR-ZXVF apache-maven-3.0.5-bin.tar.gz
- Set environment variables, open the/etc/profile file, add
- Export maven_home=/opt/apache-maven-3.0.5
- Export path= $PATH: $MAVEN _home/bin
- Execute a command to make it effective: source/etc/profile or./etc/profile
- Verification: Mvn-v
Installing Protobuf
- Decompression: TAR-ZXVF protobuf-2.5.0.tar.gz
- Go to the installation directory, configure, execute commands,./configure
- Install command: Make & make check & make install
- Verification: Protoc--version
Compiling Hadoop
- Configure the MAVEN domestic mirror configuration, set within ${maven_home}/conf/settings.xml.
1 <mirror>2 <id>CN</id>3 <name>oschina central</ Name> 4 <url>http://Maven.oschina.net/content/groups/public/</url >5 <mirrorOf>central</mirrorOf>6 </mirror>
- Importing Hadoop Project into eclipse
1 2 3 importing projects to eclipse4 5When youImportThe project to eclipse, install hadoop-maven-plugins at first.6 7$ CD hadoop-maven-Plugins8 9 $ mvn InstallTen One Then , generate Eclipse project files. A -$ MVN Eclipse:eclipse-dskiptests - theAt the last,ImportTo eclipse by specifying the root directory of the project via - -[File] > [Import] > [Existing Projects into Workspace].
Exception in thread "main" java.lang.AssertionError:Missing Tools.jar at:/library/java/javavirtualmachines/jdk1.7.0_ 60.jdk/contents/home/classes/Classes.jar. Expression:file.exists () at org.codehaus.groovy.runtime.InvokerHelper.assertFailed ( Invokerhelper.java:395) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.assertFailed (Scriptbytecodeadapter.java:683) at Org.codehaus.mojo.jspc.CompilationMojoSupport.findToolsJar (Compilationmojosupport.groovy:371) at Org.codehaus.mojo.jspc.CompilationMojoSupport. This$4$findToolsJar (Compilationmojosupport.groovy) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java:57) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:606) at Org.codehaus.groovy.reflection.CachedMethod.invoke (Cachedmethod.java:86) at Groovy.lang.MetaMethod.doMethodInvoke (Metamethod.java:230) at Groovy.lang.MetaClassImpl.invokeMethod (Metaclassimpl.java:912) at Org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (Scriptbytecodeadapter.java: 78) at Org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrent0 (Scriptbytecodeadapter.java: 112) at Org.codehaus.mojo.jspc.CompilationMojoSupport.execute (Compilationmojosupport.groovy:318) at Org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (Defaultbuildpluginmanager.java:132) at Org.apache.maven.lifecycle.internal.MojoExecutor.execute (Mojoexecutor.java:208) at Org.apache.maven.lifecycle.internal.MojoExecutor.execute (Mojoexecutor.java:153) at Org.apache.maven.lifecycle.internal.MojoExecutor.execute (Mojoexecutor.java:145) at Org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (Mojoexecutor.java:364) at Org.apache.maven.lifecycle.internal.MojoExecutor.execute (Mojoexecutor.java:198) at Org.apache.maven.lifecycle.internal.MojoExecutor.execute (Mojoexecutor.java:153) at Org.apache.maven.lifecycle.internal.MojoExecutor.execute (Mojoexecutor.java:145) at Org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (Lifecyclemodulebuilder.java: 116) at Org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (Lifecyclemodulebuilder.java: 80) at Org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build ( Singlethreadedbuilder.java:51) at Org.apache.maven.lifecycle.internal.LifecycleStarter.execute (Lifecyclestarter.java:120) at Org.apache.maven.DefaultMaven.doExecute (Defaultmaven.java:355) at Org.apache.maven.DefaultMaven.execute (Defaultmaven.java:155) at Org.apache.maven.cli.MavenCli.execute (Mavencli.java:584) at Org.apache.maven.cli.MavenCli.doMain (Mavencli.java:216) at Org.apache.maven.cli.MavenCli.main (Mavencli.java:160) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java:57) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at Org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at Org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at Org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Workaround: Http://www.tuicool.com/articles/7N7BruB
This is as the compiler needs a file named Tools.jar, localted at Classes.jar under dir classes but found nothing.so u Can do workaround:
' Java_home '/mkdir classescd Classesln-s.. /lib/tools.jar Classes.jar
But u should know,in macbook,the command ' ln ' was only effect if u locate in the target dir,otherwise u would see:
' Java_home 'mkdir classesln-s Lib/tools.jar classes/classes.jar# or:ln-s lib/tools.jar/absolute/path/to/ CLASSES/CLASSES.JARCP classes/classes.jar/tmperror:or dir found
Hadoop 2.6.0 compilation on Mac