ant怎么样编译nutch2.x?

J2EE 码拜 9年前 (2015-11-08) 1297次浏览
下载的nutch2.1 ,网上的教程都是1.x的版本;
在官网上看到 1.x不需编译,而2.x则不行,要用ant编译(至少网站上是这么说的)
然后安装了ant,在编译的时候有问题了。
2.x的目录结构下直接是 conf,doc,lib,src,build.xml等
而在src下才有一个运行需要的bin目录
本人进到解压完的根目录,直接ant (里面有build.xml)
运行一下就卡住了,里面的信息片段:
[taskdef] Could not load definitions from resource org/sonar/ant/antlib.xml. It could not be found.
ivy-probe-antlib:
ivy-download:
  [taskdef] Could not load definitions from resource org/sonar/ant/antlib.xml. It could not be found.
ivy-download-unchecked:
ivy-init-antlib:
ivy-init:
init:
    [mkdir] Created dir: /home/shaozt/softIns/CrawSource/apache-nutch-2.1/build
    [mkdir] Created dir: /home/shaozt/softIns/CrawSource/apache-nutch-2.1/build/classes
    [mkdir] Created dir: /home/shaozt/softIns/CrawSource/apache-nutch-2.1/build/release
    [mkdir] Created dir: /home/shaozt/softIns/CrawSource/apache-nutch-2.1/build/test
    [mkdir] Created dir: /home/shaozt/softIns/CrawSource/apache-nutch-2.1/build/test/classes
clean-lib:
resolve-default:
[ivy:resolve] :: Ivy 2.2.0 – 20100923230623 :: http://ant.apache.org/ivy/ ::
[ivy:resolve] :: loading settings :: file = /home/shaozt/softIns/CrawSource/apache-nutch-2.1/ivy/ivysettings.xml
解决方案:5分
不是卡住了,是[ivy:resolve] :: loading settings :: file = /home/appmon/release-2.2.1/ivy/ivysettings.xml这里要花一点时间联网检测,等一会就会继续,大约2-5分钟,假如很久没有反应,则Ctrl+C结束,再重新运行ant。
解决方案:5分
loading之后报错呢?为什么会提示module not found呢?
resolve-default:
[ivy:resolve] :: Ivy 2.2.0 – 20100923230623 :: http://ant.apache.org/ivy/ ::
[ivy:resolve] :: loading settings :: file = /home/hadoop/nutch/ivy/ivysettings.xml
[ivy:resolve] 
[ivy:resolve] :: problems summary ::
[ivy:resolve] :::: WARNINGS
[ivy:resolve]           module not found: org.elasticsearch#elasticsearch;0.90.1
[ivy:resolve]   ==== local: tried
[ivy:resolve]     /home/hadoop/.ivy2/local/org.elasticsearch/elasticsearch/0.90.1/ivys/ivy.xml
[ivy:resolve]     — artifact org.elasticsearch#elasticsearch;0.90.1!elasticsearch.jar:
[ivy:resolve]     /home/hadoop/.ivy2/local/org.elasticsearch/elasticsearch/0.90.1/jars/elasticsearch.jar
[ivy:resolve]   ==== maven2: tried
[ivy:resolve]     http://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/0.90.1/elasticsearch-0.90.1.pom
[ivy:resolve]     — artifact org.elasticsearch#elasticsearch;0.90.1!elasticsearch.jar:
[ivy:resolve]     http://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/0.90.1/elasticsearch-0.90.1.jar
[ivy:resolve]           module not found: org.apache.solr#solr-solrj;3.4.0
[ivy:resolve]   ==== local: tried
[ivy:resolve]     /home/hadoop/.ivy2/local/org.apache.solr/solr-solrj/3.4.0/ivys/ivy.xml
[ivy:resolve]     — artifact org.apache.solr#solr-solrj;3.4.0!solr-solrj.jar:
[ivy:resolve]     /home/hadoop/.ivy2/local/org.apache.solr/solr-solrj/3.4.0/jars/solr-solrj.jar
[ivy:resolve]   ==== maven2: tried
[ivy:resolve]     http://repo1.maven.org/maven2/org/apache/solr/solr-solrj/3.4.0/solr-solrj-3.4.0.pom
[ivy:resolve]     — artifact org.apache.solr#solr-solrj;3.4.0!solr-solrj.jar:
[ivy:resolve]     http://repo1.maven.org/maven2/org/apache/solr/solr-solrj/3.4.0/solr-solrj-3.4.0.jar
[ivy:resolve]           module not found: org.slf4j#slf4j-api;1.6.1
[ivy:resolve]   ==== local: tried
[ivy:resolve]     /home/hadoop/.ivy2/local/org.slf4j/slf4j-api/1.6.1/ivys/ivy.xml
[ivy:resolve]     — artifact org.slf4j#slf4j-api;1.6.1!slf4j-api.jar:
[ivy:resolve]     /home/hadoop/.ivy2/local/org.slf4j/slf4j-api/1.6.1/jars/slf4j-api.jar
[ivy:resolve]   ==== maven2: tried
[ivy:resolve]     http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.pom
[ivy:resolve]     — artifact org.slf4j#slf4j-api;1.6.1!slf4j-api.jar:
[ivy:resolve]     http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar
[ivy:resolve]           module not found: org.slf4j#slf4j-log4j12;1.6.1
[ivy:resolve]   ==== local: tried
[ivy:resolve]     /home/hadoop/.ivy2/local/org.slf4j/slf4j-log4j12/1.6.1/ivys/ivy.xml
[ivy:resolve]     — artifact org.slf4j#slf4j-log4j12;1.6.1!slf4j-log4j12.jar:
[ivy:resolve]     /home/hadoop/.ivy2/local/org.slf4j/slf4j-log4j12/1.6.1/jars/slf4j-log4j12.jar
[ivy:resolve]   ==== maven2: tried
[ivy:resolve]     http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.pom
[ivy:resolve]     — artifact org.slf4j#slf4j-log4j12;1.6.1!slf4j-log4j12.jar:
[ivy:resolve]     http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar
[ivy:resolve]           module not found: commons-lang#commons-lang;2.6
[ivy:resolve]   ==== local: tried
[ivy:resolve]     /home/hadoop/.ivy2/local/commons-lang/commons-lang/2.6/ivys/ivy.xml
[ivy:resolve]     — artifact commons-lang#commons-lang;2.6!commons-lang.jar:
[ivy:resolve]     /home/hadoop/.ivy2/local/commons-lang/commons-lang/2.6/jars/commons-lang.jar
[ivy:resolve]   ==== maven2: tried
[ivy:resolve]     http://repo1.maven.org/maven2/commons-lang/commons-lang/2.6/commons-lang-2.6.pom
[ivy:resolve]     — artifact commons-lang#commons-lang;2.6!commons-lang.jar:
[ivy:resolve]     http://repo1.maven.org/maven2/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ivy:resolve]           module not found: commons-collections#commons-collections;3.1
[ivy:resolve]   ==== local: tried
[ivy:resolve]     /home/hadoop/.ivy2/local/commons-collections/commons-collections/3.1/ivys/ivy.xml
[ivy:resolve]     — artifact commons-collections#commons-collections;3.1!commons-collections.jar:
[ivy:resolve]     /home/hadoop/.ivy2/local/commons-collections/commons-collections/3.1/jars/commons-collections.jar
[ivy:resolve]   ==== maven2: tried
[ivy:resolve]     http://repo1.maven.org/maven2/commons-collections/commons-collections/3.1/commons-collections-3.1.pom
[ivy:resolve]     — artifact commons-collections#commons-collections;3.1!commons-collections.jar:
[ivy:resolve]     http://repo1.maven.org/maven2/commons-collections/commons-collections/3.1/commons-collections-3.1.jar
[ivy:resolve]           module not found: commons-httpclient#commons-httpclient;3.1
[ivy:resolve]   ==== local: tried
[ivy:resolve]     /home/hadoop/.ivy2/local/commons-httpclient/commons-httpclient/3.1/ivys/ivy.xml
[ivy:resolve]     — artifact commons-httpclient#commons-httpclient;3.1!commons-httpclient.jar:
[ivy:resolve]     /home/hadoop/.ivy2/local/commons-httpclient/commons-httpclient/3.1/jars/commons-httpclient.jar
……
解决方案:5分
[taskdef] Could not load definitions from resource org/sonar/ant/antlib.xml. It could not be found.
ivy-probe-antlib:
ivy-download:
  [taskdef] Could not load definitions from resource org/sonar/ant/antlib.xml. It could not be found.

这个问题可以通过下载sonar的jar包,并将jar包放到相应的路径,放路径的话可以直接修改build.xml文件,在里面找到org/sonar/ant/antlib.xml,然后在classpath中修改jar的位置。
至于卡在那里不动的问题,确实是网络的问题,需要耐心等一会
假如无法正常下载jar包,有时是原因是无法连接中央仓库所导致的,可以换个地址试试,可以参考这篇博客
http://blog.csdn.net/skywalker_only/article/details/14109251

解决方案:5分

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明ant怎么样编译nutch2.x?
喜欢 (0)
[1034331897@qq.com]
分享 (0)