Hbase在eclipse中的编译(window环境)

来源:互联网 发布:玩王者荣耀网络延迟高 编辑:程序博客网 时间:2024/05/16 23:53

1>  首先安装Cygwin,并把安装的bin目录添加到path环境变量,例如E:\Cygwin\bin

2> eclipse已经安装好了m2eclipse插件

3> check out source code: 从http://svn.apache.org/repos/asf/hbase/tags/0.94.0/, 所有的文件放在E:\hbase里

4> 打开eclipse, 选择File-> Import -> Maven -> Existing Maven Projects,把上面的maven工程导入

5> 确保本机.m2下的Settings.xml已经配置好了Maven中央仓库镜像

6> 在eclipse的hbase工程中的pom.xml右键选择Run as -> Run Configurations...在Goals里面填上clean install -DskipTests 

7> 在pom.xml上右键Run as -> Maven Build


常见问题及解决方案:

1> 如果编译过程中报错:警告:sun.misc.Unsafe 是 Sun 的专用 API,可能会在未来版本中删除, 那么只需要在pom.xml中指定使用高版本的maven-compiler-plugin 插件即可,

在pom.xml的maven-compiler-plugin配置里面添加一行:<version>2.3.2</version>

<plugin>    <artifactId>maven-compiler-plugin</artifactId>    <version>2.3.2</version>    <configuration>      <source>${compileSource}</source>      <target>${compileSource}</target>      <showWarnings>true</showWarnings>      <showDeprecation>false</showDeprecation>    </configuration></plugin>


附:我的.m2/settings文件如下:

<?xml version="1.0" encoding="UTF-8"?><settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">  <mirrors>   <mirror>           <id>ibiblio.org</id>           <name>ibiblio Mirror of http://repo1.maven.org/maven2/</name>           <url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>           <mirrorOf>central</mirrorOf>           <!-- United States, North Carolina -->     </mirror>     <mirror>          <id>jboss-public-repository-group</id>          <mirrorOf>central</mirrorOf>          <name>JBoss Public Repository Group</name>          <url>http://repository.jboss.org/nexus/content/groups/public</url>      </mirror>  <mirror>          <id>m2-incubating-repository</id>          <mirrorOf>central</mirrorOf>          <name>m2-incubating-repository</name>          <url>http://people.apache.org/repo/m2-incubating-repository</url>      </mirror>   <mirror>          <id>m2-snapshot-repository</id>          <mirrorOf>central</mirrorOf>          <name>m2-snapshot-repository</name>          <url>http://people.apache.org/repo/m2-snapshot-repository</url>      </mirror>   </mirrors>  <profiles>    <profile>      <id>nexus</id>      <!--Enable snapshots for the built in central repo to direct -->      <!--all requests to nexus via the mirror -->          </profile>  </profiles>  <activeProfiles>    <!--make the profile active all the time -->    <activeProfile>nexus</activeProfile>  </activeProfiles>  </settings>


原创粉丝点击