windows 下编译 hbase源码,报错
[ERROR] Command execution failed.
java.io.IOException: Cannot run program "bash" (in directory "D:\File\ideaWorkspace\hbase-1.4.10-src\hbase-1.4.10\hbase-shaded\hbase-shaded-check-invariants\target\test-classes"): CreateProcess error=2, 系统找不到指定的文件。at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)at java.lang.Runtime.exec(Runtime.java:620)at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:804)at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:751)at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:313)at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)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:128)at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)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)at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: java.io.IOException: CreateProcess error=2, 系统找不到指定的文件。at java.lang.ProcessImpl.create(Native Method)at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)at java.lang.ProcessImpl.start(ProcessImpl.java:137)at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)... 31 more
查看发现执行shell脚本,
方法一:
在pom中查找 ensure-jars-have-correct-contents.sh 相关的配置,屏蔽掉,重新编译,
编译成功
方法二:
idea 配置 Terminal 为 GitHbash
1.首先windows 安装 git ,官网下载安装即可,
2.idea中进入setting
3.在setting 中修改Terminal 为 git-bash
4.重启,在idea中打开 Terminal ,如下图所示即为成功
好了,编译成功
以上方法二选一即可,windows编译会有很多问题,大家可以使用linux系统或者Mac也可以