尝试使用 MongoDB 编译 Nutch 2.2.1 时出错,无法从 sonar/ant/antlib.xml 加载定



我想编译Nutch 2.2.1以与MongoDB一起使用以进行数据存储。

我在文件 ivy 中将 gora 核心更改为 0.5.xml:

<dependency org="org.apache.gora" name="gora-core" rev="0.5" conf="*->default"/>
还在 ivy

/ivy.xml 文件中添加了对 mongodb 的依赖:

<dependency org="org.apache.gora" name="gora-mongodb" rev="0.5" conf="*->default" />

在 conf/gora.properties 中添加了 mongodb 配置:

############################
# MongoDBStore properties  #
############################
gora.datastore.default=org.apache.gora.mongodb.store.MongoStore
gora.mongodb.override_hadoop_configuration=false
gora.mongodb.mapping.file=/gora-mongodb-mapping.xml
gora.mongodb.servers=localhost:27017
gora.mongodb.db=nutch

添加了 gora-mongodb-mapping.xml 到 Nutch-2.3-SNAPSHOT 中的 conf 目录。

当我尝试编译时,出现错误:

Could not load definitions from resource org/sonar/ant/antlib.xml. It could not be found.

之后我收到许多编译器错误。

当我尝试使用 MySQL 配置和编译 Nutch 时,每次编译都能完美运行。

我正在尝试在 Debian 上编译。

引发错误是因为声纳 jar 不存在于其中一个类路径中(请参阅 build.xml,第 883 行)

<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
    <classpath path="${ant.library.dir}"/>
    <classpath path="${mysql.library.dir}"/>
</taskdef>

看起来可以安全地忽略警告,因为只有在运行"声纳"目标时才需要它。

一个简单的解决方案是在"声纳"目标内移动任务定义。这将避免错误消息。

我建议提出一个 JIRA 问题来解决这个问题。

纠正此错误后,我得到了另一个;-)。经过研究,我发现用Gora 0.5编译Nutch 2.2.1不可能使用MongoDB(gora-mongodb rev=0.5)。

我已经克隆了 Nutch 2.3 并成功编译了它。

最新更新