windows环境中hbase源码编译遇到的问题
转载请注明出处
问题一
[ERROR] Failed to execute goal org.codehaus.mojo:findbugs-maven-plugin:3.0.0:findbugs (default)
on project
hbase: Unable to parse configuratio
mojo org.codehaus.mojo:findbugs-maven-plugin:3.0.0:findbugs for parameter pluginArtifacts: Cannot assign configuration entry 'pluginArtifacts' with value '${plugin.artifacts}' of type java.util.Collections.UnmodifiableRandomAccessList to property of type java.util.ArrayList -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:findbugs-maven-plugin:3.0.0:findbugs (default) on project hbase: Unable to parse configuration of mojo org.codehaus.mojo:findbugs-maven-plugin:3.0.0:findbugs for parameter pluginArtifacts: Cannot assign configuration entry 'pluginArtifacts' with value '${plugin.artifacts}' of type java.util.Collections.UnmodifiableRandomAccessList to property of type java.util.ArrayList
解决方案:
降低maven的版本,在3.6.+的版本上会报这个错
问题二
[ERROR] Failed to execute gol org.apache.maven.plugins:maven-enforcer-plugin:1.4:enforce (min-maven-min-java-banned-xerces) on project hbase: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
解决方案:
修改一下pom
apache版本:
<compileSource>1.8</compileSource>
cdh版本
<javaVersion>1.8</javaVersion> <targetJavaVersion>1.8</targetJavaVersion>
问题三
Caused by: java.io.IOException: Cannot run program "bash" (in directory "。。。。。“”): CreateProcess error=2, 系统找不到指定的文件。
解决方案:
这是因为在Windows环境不能执行bash。那么需要能执行bash环境,有一个神器:Git安装git后,打开Git Bash,即可在Windows系统中执行Linux命令。
cd到hbase源码项目根目录,执行mvn package -DskipTests=true即可。
问题四
[WARNING] Some problems were encountered while building the effective model for org.apache.hbase:hbase-shaded-client:jar:1.2.0-cdh5.14.4 [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ org.apache.hbase:hbase:1.2.0-cdh5.14.4, D:\hbase_src\cdh\hbase-1.2.0-cdh5.14.4-src\hbase-1.2.0-cdh5.14.4\pom.xml, line 1059, column 15 [WARNING]
解决方案:
POM.xml中maven-compiler-plugin插件信息如下
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
问题五
编译太慢,修改镜像,找到mirrors元素, 在它里面添加子元素mirror:
<!-- 阿里云中央仓库 --> <mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror>