【甘道夫】Win7+Eclipse+Maven進行Mahout編程,使其相容Hadoop2.2.0環境運行

來源:互聯網
上載者:User

標籤:des   style   color   io   os   使用   java   ar   strong   

引言之前成功在伺服器上為Mahout0.9打patch,使其支援Hadoop2.2.0。今天的需求是:在Win7+Eclipse+Maven環境下開發Mahout程式,打jar包放到叢集上,使其在Hadoop2.2.0下正常運行。 過程 步驟一:Eclipse下建立Maven工程pom.xml:1.引入mahout依賴    <dependencies>  
        <dependency>            <groupId>org.apache.mahout</groupId>            <artifactId> mahout-core</artifactId>            <version>0.9</version>        </dependency>  
    </dependencies>
2.將依賴打進jar包的外掛程式  
    <build>        <plugins>  
            <plugin>                <artifactId> maven-assembly-plugin</artifactId>                <configuration>                    <archive>                        <manifest>                            <mainClass>cn.fulong.bigdata.ItemCFHadoop</mainClass>                        </manifest>                    </archive>                    <descriptorRefs>                        <descriptorRef>jar-with-dependencies</descriptorRef>                    </descriptorRefs>                </configuration>            </plugin>   
        </plugins>    </build>  

步驟二:關鍵--將叢集上打完patch,編譯好的mahout-core-0.9.jar和mahout-math-0.9.jar覆蓋windows下maven倉庫的對應檔案!我嘗試過將打過patch的pom檔案拷貝到windows下,然後在windows環境下編譯mahout0.9源碼,但是行不通,各種報錯。由於mahout-core所依賴的mahout相關jar包只有兩個,mahout-core-0.9.jar和mahout-math-0.9.jar,所以我們只需將叢集上支援Hadoop2.2.0的這兩個jar包覆蓋到本地即可。如果不執行該步驟,工程打jar包拷貝到叢集後將報hadoop相容性異常。
步驟三:打包,在windows環境下工程根目錄下執行命令:mvn assembly:assembly產生的jar包在工程根目錄/target/下,名稱類似 xxxxx-jar-with-dependencies.jar
步驟四:將jar包拷貝到叢集中執行注意: 使用hadoop jar執行,而不是用java jar執行!使用hadoop jar執行才能順利找到相關的hadoop資源。

【甘道夫】Win7+Eclipse+Maven進行Mahout編程,使其相容Hadoop2.2.0環境運行

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.