当前位置:编程学习 > JAVA >>

ant如何编译nutch2.x?

我下载的是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

--------------------编程问答-------------------- 你好,解决了吗
--------------------编程问答-------------------- Buildfile: /home/appmon/release-2.2.1/build.xml
Trying to override old definition of task javac
  [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/appmon/release-2.2.1/build
    [mkdir] Created dir: /home/appmon/release-2.2.1/build/classes
    [mkdir] Created dir: /home/appmon/release-2.2.1/build/release
    [mkdir] Created dir: /home/appmon/release-2.2.1/build/test
    [mkdir] Created dir: /home/appmon/release-2.2.1/build/test/classes
     [copy] Copying 9 files to /home/appmon/release-2.2.1/conf
     [copy] Copying /home/appmon/release-2.2.1/conf/automaton-urlfilter.txt.template to /home/appmon/release-2.2.1/conf/automaton-urlfilter.txt
     [copy] Copying /home/appmon/release-2.2.1/conf/hbase-site.xml.template to /home/appmon/release-2.2.1/conf/hbase-site.xml
     [copy] Copying /home/appmon/release-2.2.1/conf/httpclient-auth.xml.template to /home/appmon/release-2.2.1/conf/httpclient-auth.xml
     [copy] Copying /home/appmon/release-2.2.1/conf/nutch-site.xml.template to /home/appmon/release-2.2.1/conf/nutch-site.xml
     [copy] Copying /home/appmon/release-2.2.1/conf/prefix-urlfilter.txt.template to /home/appmon/release-2.2.1/conf/prefix-urlfilter.txt
     [copy] Copying /home/appmon/release-2.2.1/conf/regex-normalize.xml.template to /home/appmon/release-2.2.1/conf/regex-normalize.xml
     [copy] Copying /home/appmon/release-2.2.1/conf/regex-urlfilter.txt.template to /home/appmon/release-2.2.1/conf/regex-urlfilter.txt
     [copy] Copying /home/appmon/release-2.2.1/conf/subcollections.xml.template to /home/appmon/release-2.2.1/conf/subcollections.xml
     [copy] Copying /home/appmon/release-2.2.1/conf/suffix-urlfilter.txt.template to /home/appmon/release-2.2.1/conf/suffix-urlfilter.txt

clean-lib:

resolve-default:
[ivy:resolve] :: Apache Ivy 2.3.0 - 20130110142753 :: http://ant.apache.org/ivy/ ::
[ivy:resolve] :: loading settings :: file = /home/appmon/release-2.2.1/ivy/ivysettings.xml
--------------------编程问答-------------------- 和你相同问题
--------------------编程问答--------------------  求高手帮忙解决呀,那个什么缺少的包我也已经导入了。还是没有用,不是因为那个原因!!!! --------------------编程问答-------------------- 不是卡住了,是[ivy:resolve] :: loading settings :: file = /home/appmon/release-2.2.1/ivy/ivysettings.xml这里要花一点时间联网检测,等一会就会继续,大约2-5分钟,如果很久没有反应,则Ctrl+C结束,再重新运行ant。 --------------------编程问答-------------------- 楼上说的对,等一会就行了。 --------------------编程问答-------------------- 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
...... --------------------编程问答--------------------
[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 --------------------编程问答-------------------- 我是2.2版本,ant编译的时候报很多东西没找到,它需要很多依赖关系吗?下面是我截取的一部分报错:

ivy:resolve]           ::          UNRESOLVED DEPENDENCIES         ::
[ivy:resolve]           ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve]           :: org.elasticsearch#elasticsearch;0.19.4: not found
[ivy:resolve]           :: org.apache.solr#solr-solrj;3.4.0: not found
[ivy:resolve]           :: org.slf4j#slf4j-log4j12;1.6.1: not found
[ivy:resolve]           :: commons-lang#commons-lang;2.4: not found
[ivy:resolve]           :: commons-collections#commons-collections;3.1: not found
[ivy:resolve]           :: commons-httpclient#commons-httpclient;3.1: not found
[ivy:resolve]           :: commons-codec#commons-codec;1.3: not found
[ivy:resolve]           :: org.apache.hadoop#hadoop-core;1.2.0: not found
[ivy:resolve]           :: log4j#log4j;1.2.15: not found
[ivy:resolve]           :: org.jdom#jdom;1.1: not found
[ivy:resolve]           :: junit#junit;4.11: not found
[ivy:resolve]           :: org.hsqldb#hsqldb;2.2.8: not found
[ivy:resolve]           :: org.restlet.jse#org.restlet;2.0.5: not found
[ivy:resolve]           :: org.restlet.jse#org.restlet.ext.jackson;2.0.5: not found
[ivy:resolve]           :: org.apache.gora#gora-core;0.3: not found
[ivy:resolve]           :: mysql#mysql-connector-java;5.1.18: not found
[ivy:resolve]           :: com.ibm.icu#icu4j;4.0.1: not found
[ivy:resolve]           :: org.apache.tika#tika-core;1.3: not found
[ivy:resolve]           :: com.googlecode.juniversalchardet#juniversalchardet;1.0.3: not found
[ivy:resolve]           :: xerces#xercesImpl;2.9.1: not found
[ivy:resolve]           :: xerces#xmlParserAPIs;2.6.2: not found
[ivy:resolve]           :: xalan#serializer;2.7.1: not found
[ivy:resolve]           :: oro#oro;2.0.8: not found
[ivy:resolve]           :: com.google.guava#guava;11.0.2: not found
[ivy:resolve]           :: com.google.code.crawler-commons#crawler-commons;0.2: not found
[ivy:resolve]           :: org.mortbay.jetty#jetty-client;6.1.26: not found
[ivy:resolve]           ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] 
[ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
 
BUILD FAILED
/opt/apache-nutch-2.2.1/build.xml:444: impossible to resolve dependencies:
        resolve failed - see output for details
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,