`
davidxiaozhi
  • 浏览: 237135 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

mahout0.7成功编译总结

阅读更多

 

欢迎喜欢深入了解推荐系统和mahout的兄弟加入群     推荐系统之Mahout  135918911
 
一直在学习mahout,工作中使用的是0.7跑算法,进行测试,但是在使用maven导入eclipse中构建的时候出现了问题,
首先由于m2e的lifeStyle覆盖问题,两个插件不能使用,如下图


 
m2e插件现在已经被eclipse托管,在看eclipse官方网站看过文档后终于找到解决方案,
 
解决方案如下:打开我们出现问题的pom文件
例如 mahout-core下的pom文件,出错的地方,表示m2e不知道怎么处理该插件(M2E plugin execution not covered
 


 
 
鼠标放到错误地方会出现
 


 
 
选择第二项Mark goal run as .....,如果第三项(Discover new m2e connectors)能解决最好,有的时候eclipse会出现一些connectors更新,不过很少,大多数都是使用第二种方法解决,选择后我们会看见错误提示消失
 
同理mahout-examples下的pom文件也这样解决如下图
 


 
 
同理 mahout-integration下的pom文件也这样解决如下图
 


 
 
同理mahout-math下的pom文件也这样解决如下图
 


 

 
 
mahout-math的pom build中插件配置是存在问题,我们最后在解决这个问题,下面继续maven问题的解决
 
我们如下图操作
 


 
 
然后
 


 
 
我们打开lifecycle Mapping的配置文件将全部的
 <action >
        <ignore />
  </action >
  换成
    <action>
        <execute/>
   </action >
或者直接将下面粘贴进去
<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
  <pluginExecutions>
    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <versionRange>1.6</versionRange>
        <goals>
          <goal>run</goal>
        </goals>
      </pluginExecutionFilter>
      <action>
        <execute/>
      </action>
    </pluginExecution>
    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <versionRange>2.1</versionRange>
        <goals>
          <goal>copy-dependencies</goal>
        </goals>
      </pluginExecutionFilter>
      <action>
         <execute/>
      </action>
    </pluginExecution>
    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.apache.mahout</groupId>
        <artifactId>mahout-collection-codegen-plugin</artifactId>
        <versionRange>1.0</versionRange>
        <goals>
          <goal>generate</goal>
        </goals>
      </pluginExecutionFilter>
      <action>
        <execute/>
      </action>
    </pluginExecution>
  </pluginExecutions>
</lifecycleMappingMetadata>
 
注意红色部分,默认是忽略而不是执行,需要修改成执行,或者把以上直接拷贝过去
上面的maven-antrun-plugin,mahout-collection-codegen-plugin插件我们设置的都是执行
 
记得保存文件,然后在我们打开lifecycle Mapping的配置文件的配置菜单上重载红色框框下面按钮


 
 
前面说到mahout-math pom中 build配置是存在问题的,
木配置把生成的类包的存放目录添加进classpath中去
(生成路径>${project.build.directory}/generated-sources ,测试目录${project.build.directory}/generated-test-sources)
 
如果目录不同,请自己对应。
 <configuration>
              <!--<mainExcludes>-->
              <!--<mainExclude>**/AbstractBooleanList.java</mainExclude>-->
              <!--<mainExclude>**/BooleanArrayList.java</mainExclude>-->
              <!--<mainExclude>**/BooleanBufferConsumer.java</mainExclude>-->
              <!--</mainExcludes>-->
              <!--<testExcludes>-->
              <!--<testExclude>**/BooleanArrayListTest.java</testExclude>-->
              <!--</testExcludes>-->
              <outputDirectory>${project.build.directory}/generated-sources/mahout</outputDirectory>
              <testOutputDirectory>${project.build.directory}/generated-test-sources/mahout</testOutputDirectory>
 </configuration>
  新增多个java文件源码包,maven本身是不支持的,我们这里需要一个插件来解决这个问题
        <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/mahout</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-test-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-test-sources/mahout</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
 
或者我们直接粘贴0.8版本的build配置,0.8修正了这个问题,下面是0.8的配置
 
<build>
    <defaultGoal>install</defaultGoal>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.mahout</groupId>
        <artifactId>mahout-collection-codegen-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <!--<mainExcludes>-->
              <!--<mainExclude>**/AbstractBooleanList.java</mainExclude>-->
              <!--<mainExclude>**/BooleanArrayList.java</mainExclude>-->
              <!--<mainExclude>**/BooleanBufferConsumer.java</mainExclude>-->
              <!--</mainExcludes>-->
              <!--<testExcludes>-->
              <!--<testExclude>**/BooleanArrayListTest.java</testExclude>-->
              <!--</testExcludes>-->
              <outputDirectory>${project.build.directory}/generated-sources/mahout</outputDirectory>
              <testOutputDirectory>${project.build.directory}/generated-test-sources/mahout</testOutputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/mahout</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-test-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-test-sources/mahout</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- create test jar so other modules can reuse the math test utility classes. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
      </plugin>

      <plugin>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-remote-resources-plugin</artifactId>
        <configuration>
          <appendedResourcesDirectory>../src/main/appended-resources</appendedResourcesDirectory>
          <resourceBundles>
            <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle>
          </resourceBundles>
          <supplementalModels>
            <supplementalModel>supplemental-models.xml</supplementalModel>
          </supplementalModels>
        </configuration>
      </plugin>
    </plugins>
  </build>
 
 
更新配置
 


 
 
或者我们直接把下面改好的配置替换原有build配置(下面的是0.8的配置) ,建议还是使用上面第一种
 
 
 
运行maven插件  clean install -Dmaven.test.skip=true -e -X
 
 
下面是apache的一个下载正式版本的依赖,对有些人可能有用
          <repository>
               <id>apache.releases</id>
               <name>Apache Snapshot Repository</name>
               <url>https://repository.apache.org/service/local/repositories/releases/content/</url>
          </repository>

 

  • 大小: 11.3 KB
  • 大小: 14.5 KB
  • 大小: 11.3 KB
  • 大小: 18 KB
  • 大小: 13.6 KB
  • 大小: 13.4 KB
  • 大小: 16.4 KB
  • 大小: 14.6 KB
  • 大小: 30.2 KB
  • 大小: 4.5 KB
  • 大小: 173.3 KB
0
0
分享到:
评论

相关推荐

    mahout 0.7

    mahout-core-0.7.jar,注意版本hadoop-1.0.x,eclipse-3.7。(mahout0.7不支持hadoop-2.2),由mahout-distribution-0.7.tar.gz源码构建生成jar包,可以直接引入。

    mahout 0.7 src

    mahout 0.7 src, mahout 源码包, hadoop 机器学习子项目 mahout 源码包

    mahout-distribution-0.7-src.zip

    mahout0.7版本,源码,可修改源码并自己编译,使用java语言编写,maven编译

    mahout-integration-0.7

    mahout-integration-0.7mahout-integration-0.7mahout-integration-0.7mahout-integration-0.7

    mahout-0.7-core-api.chm

    mahout 中的类库解析,API,是学习mahout的好帮手

    mahout1.0编译包

    mahout0.9不能运行在hadoop2中,会报interface错误,用此新编译后的包,可实现mahout+hadoop2的运行环境,其中包括编译后的包及源码。

    mahout in action源代码maven编译jar包

    mahout in action中的example codes进行maven编译时由于maven相关jar包的URL的重定位,故无法进行有效编译,需要下载相关jar包进行手动加载!

    mahout-core-0.7-job.jar

    用于测试mahout中的决策树 ,即Partial Implementation用到的测试jar包。所谓的测试其实也只是把相应的数据可以打印出来,方便单机调试,理解算法实现原理而已。

    Eclipse下编译Mahout项目运行示例

    Mahout是基于Hadoop之上的机器学习和数据挖掘的一个分布式框架项目。搞机器智能学习算法,这个是首选。本文给出一个完整的编译运行示例,让有兴趣的同行少走段弯路,多一份参考!

    博客推荐系统源码

    运行博客推荐程序需要注意的地方: 1. 打开mysql,增加blog数据库;... 2. 修改blog.xml(和Readme.txt同目录)的docBase为本地目录,放在tomcat的conf\...版本:Spring3+Struts2+Hibernate3+Hadoop1.0.4+Mahout0.7+Mysql5

    如何成功运行Apache Mahout的Taste Webapp-Mahout推荐教程-Maven3.0.5-JDK1.6-Mahout0.5

    教你成功运行mahout的taste webapp例子,网上的很多资料说的不清楚,或者版本冲突。正确的版本是jdk1.6 maven3.0.5 mahout0.5 。 摸索良久,亲测有效!

    maven_mahout_template-mahout-0.8

    maven_mahout_template-mahout-0.8

    mahout api 学习资料

    mahout_help,mahout的java api帮助文档,可以帮你更轻松掌握mahout

    apache-mahout-distribution-0.11.0-src.zip

    mahout0.11版本,源码,可修改源码并自己编译,使用java语言编写,maven编译

    mahout-0.11.1 相关的jar

    mahout-examples-0.11.1 mahout-examples-0.11.1-job mahout-h2o_2.10-0.11.1 mahout-h2o_2.10-0.11.1-dependency-reduced mahout-hdfs-0.11.1 mahout-integration-0.11.1 mahout-math-0.11.1 mahout-math-0.11.1 ...

    MAHOUT实战(中文版)

    MAHOUT实战 MAHOUT IN ACTION

    Learning.Apache.Mahout.1783555211

    If you are a Java developer and want to use Mahout and Machine Learning to solve Big Data analytics use-cases then this book is for you. Familiarity with shell-scripts is assumed but no prior ...

    mahout Algorithms源码分析

    mahoutAlgorithms源码分析 mahout代码解析

    人工智能-推荐系统-新闻推荐-基于Mahout的新闻推荐系统

    Mahout:整体框架,实现了协同过滤 Deeplearning4j,构建VSM Jieba:分词,关键词提取 HanLP:分词,关键词提取 Spring Boot:提供API、ORM 关键实现 基于用户的协同过滤 直接调用Mahout相关接口即可 选择不同...

Global site tag (gtag.js) - Google Analytics