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>


Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐