- 浏览: 943237 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (385)
- 搜索引擎学习 (62)
- 算法 (1)
- 数据库 (15)
- web开发 (38)
- solr开发 (17)
- nutch 1.2 系统学习 (8)
- cms (1)
- 系统架构 (11)
- linux 与 unix 编程 (16)
- android (15)
- maven (1)
- 关注物流 (1)
- 网址收集 (1)
- 分布式,集群 (1)
- mysql (5)
- apache (1)
- 资料文档备份 (7)
- 上班有感 (0)
- 工作流 (15)
- javascript (1)
- weblogic (1)
- eclipse 集成 (1)
- JMS (7)
- Hibernate (1)
- 性能测试 (1)
- spring (6)
- 缓存cache (1)
- mongodb (2)
- webservice (1)
- HTML5 COCOS2D-HTML5 (1)
- BrowserQuest (2)
最新评论
-
avi9111:
内陷到android, ios, winphone里面也是随便 ...
【HTML5游戏开发】二次开发 BrowserQuest 第一集 -
avi9111:
呵呵,做不下去了吧,没有第二集了吧,游戏是个深坑,谨慎进入,其 ...
【HTML5游戏开发】二次开发 BrowserQuest 第一集 -
excaliburace:
方案3亲测完全可用,顺便解决了我其他方面的一些疑问,非常感谢
spring security 2添加用户验证码 -
yuanliangding:
Spring太强大了。
Spring Data JPA 简单介绍 -
小高你好:
什么是hibernate懒加载?什么时候用懒加载?为什么要用懒加载?
花了很多时间来读这个build.xml,并不是这个包不好读,相反可读性非常强,这就是xml的好处.自己花了很多的时间
去熟悉ant!从Ant的task,type,nested element等一点一点读起.这样整个nutch的配置结构,我就了解的更加清楚了.
解下来的任务就是继续熟悉一下Javacc这个软件,在读一下它的api文档,下来的工作就是修改nutch了.
将build.xml的内容粘于此处.
<?xml version='1.0' encoding='GBK'?>
<!--如果出现汉字,请使用GBK编码-->
<project name="Nutch" default="compile">
<!--修改意见-->
<!--可以写一个deploy模块,把war文件拷贝到tomcat/webapps下面去,这部分文中没有涉及-->
<!-- Load all the default properties, and any the user wants -->
<!-- to contribute (without having to type -D or edit this file -->
<!--没有找到build.properties??-->
<!--properry为task-->
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<property file="${basedir}/default.properties" />
<!-- the normal classpath -->
<!--build.classes下含有lib.dir下的所有的jar文件-->
<!--path-like structure,定义classpath-->
<path id="classpath">
<pathelement location="${build.classes}"/>
<!--fileset为type-->
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<!-- the unit test classpath -->
<!--dirname为Task-->
<dirname property="plugins.classpath.dir" file="${build.plugins}"/>
<path id="test.classpath">
<pathelement location="${test.build.classes}" />
<pathelement location="${conf.dir}"/>
<pathelement location="${test.src.dir}"/>
<pathelement location="${plugins.classpath.dir}"/>
<!--使用前面定义的classpath-->
<path refid="classpath"/>
</path>
<!-- xmlcatalog definition for xslt task -->
<!--使用xmlcatalog type定义docDTDs-->
<xmlcatalog id="docDTDs">
<dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"
location="${xmlcatalog.dir}/xhtml1-transitional.dtd"/>
</xmlcatalog>
<!-- ====================================================== -->
<!-- Stuff needed by all targets -->
<!-- ====================================================== -->
<target name="init">
<!--mkdir为task,创建用于build和test的目录-->
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${test.build.dir}"/>
<mkdir dir="${test.build.classes}"/>
<!--将conf.dir中对应格式的文件修改时间设为datetime-->
<touch datetime="01/25/1971 2:00 pm">
<fileset dir="${conf.dir}" includes="**/*.template"/>
</touch>
<copy todir="${conf.dir}" verbose="true">
<fileset dir="${conf.dir}" includes="**/*.template"/>
<!--mapper为type,将*.template转为*-->
<mapper type="glob" from="*.template" to="*"/>
</copy>
</target>
<!-- ====================================================== -->
<!-- Compile the Java files -->
<!-- ====================================================== -->
<target name="compile" depends="compile-core, compile-plugins, jar"/>
<target name="compile-core" depends="init">
<!--将生成的class文件存入build/classes-->
<javac
encoding="${build.encoding}"
srcdir="${src.dir}"
includes="org/apache/nutch/**/*.java"
destdir="${build.classes}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}">
<!--使用已经定义的classpath-->
<classpath refid="classpath"/>
</javac>
</target>
<target name="compile-plugins">
<!--执行src/plugin下面的build.xml,并且执行其中的deploytarget,不继承property-->
<ant dir="src/plugin" target="deploy" inheritAll="false"/>
</target>
<target name="generate-src" depends="init">
<!--使用javacc命令-->
<javacc target="${src.dir}/org/apache/nutch/quality/dynamic/PageDescription.jj"
javacchome="${javacc.home}">
</javacc>
<!--对NutchAnalysis.jj运行javacc,我们修改分词需要修改此接口-->
<javacc target="${src.dir}/org/apache/nutch/analysis/NutchAnalysis.jj"
javacchome="${javacc.home}">
</javacc>
<!--CR即为carriage(回车),LF即为Line Feed(换行)即将src.dir下的匹配文件eof以lf代替-->
<fixcrlf srcdir="${src.dir}" eol="lf" includes="**/*.java"/>
</target>
<target name="dynamic" depends="generate-src, compile">
</target>
<!-- ================================================================== -->
<!-- Make nutch.jar -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar" depends="compile-core">
<!--将conf目录下的nutch-default.xml和nutch-site.xml拷入build文件目下-->
<copy file="${conf.dir}/nutch-default.xml"
todir="${build.classes}"/>
<copy file="${conf.dir}/nutch-site.xml"
todir="${build.classes}"/>
<!--将build/classes下的文件打包成jar-->
<jar
jarfile="${build.dir}/${final.name}.jar"
basedir="${build.classes}"
/>
<!--将生成的nutch-0.7.jar拷贝到根目录下命名为nutch.jar-->
<copy file="${build.dir}/${final.name}.jar" tofile="${basedir}/${name}.jar" />
</target>
<!-- ================================================================== -->
<!-- Make nutch.war -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="war" depends="compile,generate-docs">
<!--war是一个task,将里面包含的所有的东西打包成一个war文件,如果需要修改前台的界面包括
nutch的logo等等,都要提前修改其中的一些图片,界面.最后打好包放到tomcat中-->
<war destfile="${build.dir}/${final.name}.war"
webxml="${web.src.dir}/web.xml">
<fileset dir="${web.src.dir}/jsp"/>
<zipfileset dir="${docs.src}" includes="include/*.html"/>
<zipfileset dir="${build.docs}" includes="*/include/*.html"/>
<fileset dir="${docs.dir}"/>
<lib dir="${lib.dir}">
<include name="lucene*.jar"/>
<include name="taglibs-*.jar"/>
<include name="dom4j-*.jar"/>
<include name="xerces-*.jar"/>
</lib>
<lib dir="${build.dir}">
<include name="${final.name}.jar"/>
</lib>
<classes dir="${conf.dir}" excludes="**/*.template"/>
<classes dir="${web.src.dir}/locale"/>
<zipfileset prefix="WEB-INF/classes/plugins" dir="${build.plugins}"/>
<webinf dir="${lib.dir}">
<include name="taglibs-*.tld"/>
</webinf>
</war>
</target>
<!-- ================================================================== -->
<!-- Compile test code -->
<!-- ================================================================== -->
<target name="compile-core-test" depends="compile-core">
<javac
encoding="${build.encoding}"
srcdir="${test.src.dir}"
includes="org/apache/nutch/**/*.java"
destdir="${test.build.classes}"
debug="${debug}"
deprecation="${deprecation}">
<!--使用先前定义的test.classpath-->
<classpath refid="test.classpath"/>
</javac>
</target>
<!-- ================================================================== -->
<!-- Run unit tests -->
<!-- ================================================================== -->
<target name="test" depends="test-core, test-plugins"/>
<target name="test-core" depends="compile, compile-core-test">
<delete dir="${test.build.data}"/>
<mkdir dir="${test.build.data}"/>
<!--使用nutch-site.xml-->
<copy file="${test.src.dir}/nutch-site.xml"
todir="${test.build.classes}"/>
<!--junit为一个task,支持nested element,譬如sysproperty,formatter,batchtest-->
<junit printsummary="yes" haltonfailure="no" fork="yes" dir="${basedir}"
errorProperty="tests.failed" failureProperty="tests.failed">
<sysproperty key="test.build.data" value="${test.build.data}"/>
<sysproperty key="test.src.dir" value="${test.src.dir}"/>
<classpath refid="test.classpath"/>
<formatter type="plain" />
<batchtest todir="${test.build.dir}" unless="testcase">
<fileset dir="${test.src.dir}"
includes="**/Test*.java" excludes="**/${test.exclude}.java" />
</batchtest>
<batchtest todir="${test.build.dir}" if="testcase">
<fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<!--fail为task-->
<fail if="tests.failed">Tests failed!</fail>
</target>
<target name="test-plugins" depends="compile">
<ant dir="src/plugin" target="test" inheritAll="false"/>
</target>
<target name="nightly" depends="test, tar">
</target>
<!-- ================================================================== -->
<!-- Documentation -->
<!-- ================================================================== -->
<target name="javadoc" depends="compile">
<mkdir dir="${build.javadoc}"/>
<!--javadoc为task,支持nested element,譬如packageset,link,group-->
<javadoc
overview="${src.dir}/overview.html"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} API"
bottom="Copyright &copy; ${year} The Apache Software Foundation"
>
<packageset dir="${src.dir}"/>
<packageset dir="${plugins.dir}/protocol-file/src/java"/>
<packageset dir="${plugins.dir}/protocol-ftp/src/java"/>
<packageset dir="${plugins.dir}/protocol-http/src/java"/>
<packageset dir="${plugins.dir}/protocol-httpclient/src/java"/>
<packageset dir="${plugins.dir}/parse-html/src/java"/>
<packageset dir="${plugins.dir}/parse-js/src/java"/>
<packageset dir="${plugins.dir}/parse-text/src/java"/>
<packageset dir="${plugins.dir}/parse-pdf/src/java"/>
<!-- <packageset dir="${plugins.dir}/parse-rtf/src/java"/> plugin excluded from build due to licensing issues-->
<!-- <packageset dir="${plugins.dir}/parse-mp3/src/java"/> plugin excluded from build due to licensing issues-->
<packageset dir="${plugins.dir}/parse-msword/src/java"/>
<packageset dir="${plugins.dir}/index-basic/src/java"/>
<packageset dir="${plugins.dir}/index-more/src/java"/>
<packageset dir="${plugins.dir}/query-more/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-regex/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-prefix/src/java"/>
<packageset dir="${plugins.dir}/creativecommons/src/java"/>
<packageset dir="${plugins.dir}/languageidentifier/src/java"/>
<packageset dir="${plugins.dir}/clustering-carrot2/src/java"/>
<packageset dir="${plugins.dir}/ontology/src/java"/>
<link href="${javadoc.link.java}"/>
<link href="${javadoc.link.lucene}"/>
<classpath refid="classpath"/>
<classpath>
<fileset dir="${plugins.dir}" >
<include name="**/*.jar"/>
</fileset>
</classpath>
<group title="Core" packages="org.apache.nutch.*"/>
<group title="Plugins" packages="${plugins.packages}"/>
</javadoc>
</target>
<target name="default-doc">
<!--style即xslt命令,使用xsl文件解析xml-->
<style basedir="${conf.dir}" destdir="${docs.dir}"
includes="nutch-default.xml" style="conf/nutch-conf.xsl"/>
</target>
<target name="generate-locale" if="doc.locale">
<echo message="Generating docs for locale=${doc.locale}"/>
<mkdir dir="${build.docs}/${doc.locale}/include"/>
<xslt in="${docs.src}/include/${doc.locale}/header.xml"
out="${build.docs}/${doc.locale}/include/header.html"
style="${docs.src}/style/nutch-header.xsl">
<xmlcatalog refid="docDTDs"/>
</xslt>
<dependset>
<srcfileset dir="${docs.src}/include/${doc.locale}" includes="*.xml"/>
<srcfileset dir="${docs.src}/style" includes="*.xsl"/>
<targetfileset dir="${docs.dir}/${doc.locale}" includes="*.html"/>
</dependset>
<copy file="${docs.src}/style/nutch-page.xsl"
todir="${build.docs}/${doc.locale}"
preservelastmodified="true"/>
<xslt basedir="${docs.src}/pages/${doc.locale}"
destdir="${docs.dir}/${doc.locale}"
includes="*.xml"
style="${build.docs}/${doc.locale}/nutch-page.xsl">
<xmlcatalog refid="docDTDs"/>
</xslt>
</target>
<target name="generate-docs" depends="init">
<dependset>
<srcfileset dir="${docs.src}/include" includes="*.html"/>
<targetfileset dir="${docs.dir}" includes="**/*.html"/>
</dependset>
<mkdir dir="${build.docs}/include"/>
<copy todir="${build.docs}/include">
<fileset dir="${docs.src}/include"/>
</copy>
<!--antcall为task,调用generate-locale,并将相应的参数传递过去-->
<antcall target="generate-locale">
<param name="doc.locale" value="ca"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="de"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="en"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="es"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="fi"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="fr"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="hu"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="jp"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="ms"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="nl"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="pl"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="pt"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="sv"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="th"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="zh"/>
</antcall>
<fixcrlf srcdir="${docs.dir}" eol="lf" encoding="utf-8"
includes="**/*.html"/>
</target>
<!-- ================================================================== -->
<!-- D I S T R I B U T I O N -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<!--将所有的东西,包括.jar,.war等文件都拷贝到dist目录中-->
<target name="package" depends="jar, war, javadoc">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/lib"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/docs"/>
<mkdir dir="${dist.dir}/docs/api"/>
<mkdir dir="${dist.dir}/plugins"/>
<copy todir="${dist.dir}/lib" includeEmptyDirs="false">
<fileset dir="lib"/>
</copy>
<copy todir="${dist.dir}/plugins">
<fileset dir="${build.plugins}"/>
</copy>
<copy file="${build.dir}/${final.name}.jar" todir="${dist.dir}"/>
<copy file="${build.dir}/${final.name}.war" todir="${dist.dir}"/>
<copy todir="${dist.dir}/bin">
<fileset dir="bin"/>
</copy>
<copy todir="${dist.dir}/conf">
<fileset dir="${conf.dir}" excludes="**/*.template"/>
</copy>
<chmod perm="ugo+x" type="file">
<fileset dir="${dist.dir}/bin"/>
</chmod>
<copy todir="${dist.dir}/docs">
<fileset dir="${docs.dir}"/>
</copy>
<copy todir="${dist.dir}/docs/api">
<fileset dir="${build.javadoc}"/>
</copy>
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${dist.dir}/src" includeEmptyDirs="false">
<fileset dir="src"/>
</copy>
<copy todir="${dist.dir}/" file="build.xml"/>
<copy todir="${dist.dir}/" file="default.properties"/>
</target>
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
<!--打包成压缩文件-->
<target name="tar" depends="package">
<tar compression="gzip" longfile="gnu"
destfile="${build.dir}/${final.name}.tar.gz">
<tarfileset dir="${build.dir}" mode="664">
<exclude name="${final.name}/bin/*" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${build.dir}" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</tar>
</target>
<!-- ================================================================== -->
<!-- Clean. Delete the build files, and their directories -->
<!-- ================================================================== -->
<target name="clean">
<delete dir="${build.dir}"/>
<delete failonerror="true" file="${name}.jar" />
</target>
</project>
去熟悉ant!从Ant的task,type,nested element等一点一点读起.这样整个nutch的配置结构,我就了解的更加清楚了.
解下来的任务就是继续熟悉一下Javacc这个软件,在读一下它的api文档,下来的工作就是修改nutch了.
将build.xml的内容粘于此处.
<?xml version='1.0' encoding='GBK'?>
<!--如果出现汉字,请使用GBK编码-->
<project name="Nutch" default="compile">
<!--修改意见-->
<!--可以写一个deploy模块,把war文件拷贝到tomcat/webapps下面去,这部分文中没有涉及-->
<!-- Load all the default properties, and any the user wants -->
<!-- to contribute (without having to type -D or edit this file -->
<!--没有找到build.properties??-->
<!--properry为task-->
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<property file="${basedir}/default.properties" />
<!-- the normal classpath -->
<!--build.classes下含有lib.dir下的所有的jar文件-->
<!--path-like structure,定义classpath-->
<path id="classpath">
<pathelement location="${build.classes}"/>
<!--fileset为type-->
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<!-- the unit test classpath -->
<!--dirname为Task-->
<dirname property="plugins.classpath.dir" file="${build.plugins}"/>
<path id="test.classpath">
<pathelement location="${test.build.classes}" />
<pathelement location="${conf.dir}"/>
<pathelement location="${test.src.dir}"/>
<pathelement location="${plugins.classpath.dir}"/>
<!--使用前面定义的classpath-->
<path refid="classpath"/>
</path>
<!-- xmlcatalog definition for xslt task -->
<!--使用xmlcatalog type定义docDTDs-->
<xmlcatalog id="docDTDs">
<dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"
location="${xmlcatalog.dir}/xhtml1-transitional.dtd"/>
</xmlcatalog>
<!-- ====================================================== -->
<!-- Stuff needed by all targets -->
<!-- ====================================================== -->
<target name="init">
<!--mkdir为task,创建用于build和test的目录-->
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${test.build.dir}"/>
<mkdir dir="${test.build.classes}"/>
<!--将conf.dir中对应格式的文件修改时间设为datetime-->
<touch datetime="01/25/1971 2:00 pm">
<fileset dir="${conf.dir}" includes="**/*.template"/>
</touch>
<copy todir="${conf.dir}" verbose="true">
<fileset dir="${conf.dir}" includes="**/*.template"/>
<!--mapper为type,将*.template转为*-->
<mapper type="glob" from="*.template" to="*"/>
</copy>
</target>
<!-- ====================================================== -->
<!-- Compile the Java files -->
<!-- ====================================================== -->
<target name="compile" depends="compile-core, compile-plugins, jar"/>
<target name="compile-core" depends="init">
<!--将生成的class文件存入build/classes-->
<javac
encoding="${build.encoding}"
srcdir="${src.dir}"
includes="org/apache/nutch/**/*.java"
destdir="${build.classes}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}">
<!--使用已经定义的classpath-->
<classpath refid="classpath"/>
</javac>
</target>
<target name="compile-plugins">
<!--执行src/plugin下面的build.xml,并且执行其中的deploytarget,不继承property-->
<ant dir="src/plugin" target="deploy" inheritAll="false"/>
</target>
<target name="generate-src" depends="init">
<!--使用javacc命令-->
<javacc target="${src.dir}/org/apache/nutch/quality/dynamic/PageDescription.jj"
javacchome="${javacc.home}">
</javacc>
<!--对NutchAnalysis.jj运行javacc,我们修改分词需要修改此接口-->
<javacc target="${src.dir}/org/apache/nutch/analysis/NutchAnalysis.jj"
javacchome="${javacc.home}">
</javacc>
<!--CR即为carriage(回车),LF即为Line Feed(换行)即将src.dir下的匹配文件eof以lf代替-->
<fixcrlf srcdir="${src.dir}" eol="lf" includes="**/*.java"/>
</target>
<target name="dynamic" depends="generate-src, compile">
</target>
<!-- ================================================================== -->
<!-- Make nutch.jar -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar" depends="compile-core">
<!--将conf目录下的nutch-default.xml和nutch-site.xml拷入build文件目下-->
<copy file="${conf.dir}/nutch-default.xml"
todir="${build.classes}"/>
<copy file="${conf.dir}/nutch-site.xml"
todir="${build.classes}"/>
<!--将build/classes下的文件打包成jar-->
<jar
jarfile="${build.dir}/${final.name}.jar"
basedir="${build.classes}"
/>
<!--将生成的nutch-0.7.jar拷贝到根目录下命名为nutch.jar-->
<copy file="${build.dir}/${final.name}.jar" tofile="${basedir}/${name}.jar" />
</target>
<!-- ================================================================== -->
<!-- Make nutch.war -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="war" depends="compile,generate-docs">
<!--war是一个task,将里面包含的所有的东西打包成一个war文件,如果需要修改前台的界面包括
nutch的logo等等,都要提前修改其中的一些图片,界面.最后打好包放到tomcat中-->
<war destfile="${build.dir}/${final.name}.war"
webxml="${web.src.dir}/web.xml">
<fileset dir="${web.src.dir}/jsp"/>
<zipfileset dir="${docs.src}" includes="include/*.html"/>
<zipfileset dir="${build.docs}" includes="*/include/*.html"/>
<fileset dir="${docs.dir}"/>
<lib dir="${lib.dir}">
<include name="lucene*.jar"/>
<include name="taglibs-*.jar"/>
<include name="dom4j-*.jar"/>
<include name="xerces-*.jar"/>
</lib>
<lib dir="${build.dir}">
<include name="${final.name}.jar"/>
</lib>
<classes dir="${conf.dir}" excludes="**/*.template"/>
<classes dir="${web.src.dir}/locale"/>
<zipfileset prefix="WEB-INF/classes/plugins" dir="${build.plugins}"/>
<webinf dir="${lib.dir}">
<include name="taglibs-*.tld"/>
</webinf>
</war>
</target>
<!-- ================================================================== -->
<!-- Compile test code -->
<!-- ================================================================== -->
<target name="compile-core-test" depends="compile-core">
<javac
encoding="${build.encoding}"
srcdir="${test.src.dir}"
includes="org/apache/nutch/**/*.java"
destdir="${test.build.classes}"
debug="${debug}"
deprecation="${deprecation}">
<!--使用先前定义的test.classpath-->
<classpath refid="test.classpath"/>
</javac>
</target>
<!-- ================================================================== -->
<!-- Run unit tests -->
<!-- ================================================================== -->
<target name="test" depends="test-core, test-plugins"/>
<target name="test-core" depends="compile, compile-core-test">
<delete dir="${test.build.data}"/>
<mkdir dir="${test.build.data}"/>
<!--使用nutch-site.xml-->
<copy file="${test.src.dir}/nutch-site.xml"
todir="${test.build.classes}"/>
<!--junit为一个task,支持nested element,譬如sysproperty,formatter,batchtest-->
<junit printsummary="yes" haltonfailure="no" fork="yes" dir="${basedir}"
errorProperty="tests.failed" failureProperty="tests.failed">
<sysproperty key="test.build.data" value="${test.build.data}"/>
<sysproperty key="test.src.dir" value="${test.src.dir}"/>
<classpath refid="test.classpath"/>
<formatter type="plain" />
<batchtest todir="${test.build.dir}" unless="testcase">
<fileset dir="${test.src.dir}"
includes="**/Test*.java" excludes="**/${test.exclude}.java" />
</batchtest>
<batchtest todir="${test.build.dir}" if="testcase">
<fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<!--fail为task-->
<fail if="tests.failed">Tests failed!</fail>
</target>
<target name="test-plugins" depends="compile">
<ant dir="src/plugin" target="test" inheritAll="false"/>
</target>
<target name="nightly" depends="test, tar">
</target>
<!-- ================================================================== -->
<!-- Documentation -->
<!-- ================================================================== -->
<target name="javadoc" depends="compile">
<mkdir dir="${build.javadoc}"/>
<!--javadoc为task,支持nested element,譬如packageset,link,group-->
<javadoc
overview="${src.dir}/overview.html"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} API"
bottom="Copyright &copy; ${year} The Apache Software Foundation"
>
<packageset dir="${src.dir}"/>
<packageset dir="${plugins.dir}/protocol-file/src/java"/>
<packageset dir="${plugins.dir}/protocol-ftp/src/java"/>
<packageset dir="${plugins.dir}/protocol-http/src/java"/>
<packageset dir="${plugins.dir}/protocol-httpclient/src/java"/>
<packageset dir="${plugins.dir}/parse-html/src/java"/>
<packageset dir="${plugins.dir}/parse-js/src/java"/>
<packageset dir="${plugins.dir}/parse-text/src/java"/>
<packageset dir="${plugins.dir}/parse-pdf/src/java"/>
<!-- <packageset dir="${plugins.dir}/parse-rtf/src/java"/> plugin excluded from build due to licensing issues-->
<!-- <packageset dir="${plugins.dir}/parse-mp3/src/java"/> plugin excluded from build due to licensing issues-->
<packageset dir="${plugins.dir}/parse-msword/src/java"/>
<packageset dir="${plugins.dir}/index-basic/src/java"/>
<packageset dir="${plugins.dir}/index-more/src/java"/>
<packageset dir="${plugins.dir}/query-more/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-regex/src/java"/>
<packageset dir="${plugins.dir}/urlfilter-prefix/src/java"/>
<packageset dir="${plugins.dir}/creativecommons/src/java"/>
<packageset dir="${plugins.dir}/languageidentifier/src/java"/>
<packageset dir="${plugins.dir}/clustering-carrot2/src/java"/>
<packageset dir="${plugins.dir}/ontology/src/java"/>
<link href="${javadoc.link.java}"/>
<link href="${javadoc.link.lucene}"/>
<classpath refid="classpath"/>
<classpath>
<fileset dir="${plugins.dir}" >
<include name="**/*.jar"/>
</fileset>
</classpath>
<group title="Core" packages="org.apache.nutch.*"/>
<group title="Plugins" packages="${plugins.packages}"/>
</javadoc>
</target>
<target name="default-doc">
<!--style即xslt命令,使用xsl文件解析xml-->
<style basedir="${conf.dir}" destdir="${docs.dir}"
includes="nutch-default.xml" style="conf/nutch-conf.xsl"/>
</target>
<target name="generate-locale" if="doc.locale">
<echo message="Generating docs for locale=${doc.locale}"/>
<mkdir dir="${build.docs}/${doc.locale}/include"/>
<xslt in="${docs.src}/include/${doc.locale}/header.xml"
out="${build.docs}/${doc.locale}/include/header.html"
style="${docs.src}/style/nutch-header.xsl">
<xmlcatalog refid="docDTDs"/>
</xslt>
<dependset>
<srcfileset dir="${docs.src}/include/${doc.locale}" includes="*.xml"/>
<srcfileset dir="${docs.src}/style" includes="*.xsl"/>
<targetfileset dir="${docs.dir}/${doc.locale}" includes="*.html"/>
</dependset>
<copy file="${docs.src}/style/nutch-page.xsl"
todir="${build.docs}/${doc.locale}"
preservelastmodified="true"/>
<xslt basedir="${docs.src}/pages/${doc.locale}"
destdir="${docs.dir}/${doc.locale}"
includes="*.xml"
style="${build.docs}/${doc.locale}/nutch-page.xsl">
<xmlcatalog refid="docDTDs"/>
</xslt>
</target>
<target name="generate-docs" depends="init">
<dependset>
<srcfileset dir="${docs.src}/include" includes="*.html"/>
<targetfileset dir="${docs.dir}" includes="**/*.html"/>
</dependset>
<mkdir dir="${build.docs}/include"/>
<copy todir="${build.docs}/include">
<fileset dir="${docs.src}/include"/>
</copy>
<!--antcall为task,调用generate-locale,并将相应的参数传递过去-->
<antcall target="generate-locale">
<param name="doc.locale" value="ca"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="de"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="en"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="es"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="fi"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="fr"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="hu"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="jp"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="ms"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="nl"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="pl"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="pt"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="sv"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="th"/>
</antcall>
<antcall target="generate-locale">
<param name="doc.locale" value="zh"/>
</antcall>
<fixcrlf srcdir="${docs.dir}" eol="lf" encoding="utf-8"
includes="**/*.html"/>
</target>
<!-- ================================================================== -->
<!-- D I S T R I B U T I O N -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<!--将所有的东西,包括.jar,.war等文件都拷贝到dist目录中-->
<target name="package" depends="jar, war, javadoc">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/lib"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/docs"/>
<mkdir dir="${dist.dir}/docs/api"/>
<mkdir dir="${dist.dir}/plugins"/>
<copy todir="${dist.dir}/lib" includeEmptyDirs="false">
<fileset dir="lib"/>
</copy>
<copy todir="${dist.dir}/plugins">
<fileset dir="${build.plugins}"/>
</copy>
<copy file="${build.dir}/${final.name}.jar" todir="${dist.dir}"/>
<copy file="${build.dir}/${final.name}.war" todir="${dist.dir}"/>
<copy todir="${dist.dir}/bin">
<fileset dir="bin"/>
</copy>
<copy todir="${dist.dir}/conf">
<fileset dir="${conf.dir}" excludes="**/*.template"/>
</copy>
<chmod perm="ugo+x" type="file">
<fileset dir="${dist.dir}/bin"/>
</chmod>
<copy todir="${dist.dir}/docs">
<fileset dir="${docs.dir}"/>
</copy>
<copy todir="${dist.dir}/docs/api">
<fileset dir="${build.javadoc}"/>
</copy>
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${dist.dir}/src" includeEmptyDirs="false">
<fileset dir="src"/>
</copy>
<copy todir="${dist.dir}/" file="build.xml"/>
<copy todir="${dist.dir}/" file="default.properties"/>
</target>
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
<!--打包成压缩文件-->
<target name="tar" depends="package">
<tar compression="gzip" longfile="gnu"
destfile="${build.dir}/${final.name}.tar.gz">
<tarfileset dir="${build.dir}" mode="664">
<exclude name="${final.name}/bin/*" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${build.dir}" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</tar>
</target>
<!-- ================================================================== -->
<!-- Clean. Delete the build files, and their directories -->
<!-- ================================================================== -->
<target name="clean">
<delete dir="${build.dir}"/>
<delete failonerror="true" file="${name}.jar" />
</target>
</project>
评论
1 楼
koubi1986
2013-08-20
你好!请教一些问题:
请问一下
1。你是如何把nutch抓取到的二进制内容,在项目中读取的。
2。nutch抓取时候,发现有很多url没有被成功抓取过来,请问你做的时候,有什么 办法是提高成功率。
3。对抓取过来内容你们是如何进行关键词搜索
希望群主可以帮忙解答一下。万分感激!
email:83132614@qq.com
请问一下
1。你是如何把nutch抓取到的二进制内容,在项目中读取的。
2。nutch抓取时候,发现有很多url没有被成功抓取过来,请问你做的时候,有什么 办法是提高成功率。
3。对抓取过来内容你们是如何进行关键词搜索
希望群主可以帮忙解答一下。万分感激!
email:83132614@qq.com
发表评论
-
nutch1.4 环境变量设置
2012-04-06 12:52 1679Exception in thread "main& ... -
正则使用
2010-06-18 00:19 1098java正则表达式(java.Regex)HtmlParser ... -
nutch 1.0 读源码,过滤掉不正确的URL实现方法
2010-06-18 00:17 3334nutch 1.0 读源码,过滤掉不正确的URL实现方法: ... -
Exception in thread "main" org.apache.hadoop.mapred.InvalidInputExnutch新发现,为以后备忘
2010-06-16 23:16 2262urls -dir mycrawl -depth 3 -top ... -
HTMLParser 解析html字符串,提取纯文本
2010-05-14 09:59 8289今天在群里问别人怎么提取文本,也没有具体告诉我用什么,只是说用 ... -
HTMLParser的两种使用方法[转]
2010-05-13 23:37 1881HTMLParser的两种使用方法 文章分类:Java编程 ... -
搜索引擎术语
2010-05-05 11:40 1390附录. 术语 B: 半结构化 ... -
影响Lucene索引速度原因以及提高索引速度技巧[转]
2010-04-25 00:11 2711影响Lucene索引速度原因以及提高索引速度技巧 关键字: ... -
如何配置compass的索引位置为相对路径
2009-09-01 19:28 1475Compass是对lucene进行封装 ... -
heritrix 基本介绍
2009-08-01 10:35 3845Heritrix使用小结 1. H ... -
我对HtmlParser 提取网页各属性的总结及示例说明
2009-07-08 13:50 1902/** * 属性过滤器 * @param parser ... -
数学之美 系列十三 信息指纹及其应用
2009-06-25 22:34 10052006年8月3日 上午 11:17:00 ... -
数学之美系列二十一 - 布隆过滤器(Bloom Filter)
2009-06-25 22:27 14812007年7月3日 上午 09:35:00 ... -
用HTMLParser提取URL页面超链接的一段代码(小试牛刀)
2009-06-06 16:54 7054用HTMLParser提取URL页面超 ... -
深入学习Heritrix---解析处理器(Processor)
2009-06-06 13:17 1596键字: heritrix processor 本节解析与 ... -
深入学习Heritrix---解析Frontier(链接工厂)
2009-06-06 10:02 1170Frontier是Heritrix最核心的组成部分之一,也是最 ... -
深入学习Heritrix---解析CrawlController
2009-06-06 10:00 1345当我们以Web UI方式使用Heritrix时,点击任务开始( ... -
深入学习Heritrix---解析Frontier(链接工厂)
2009-06-03 21:50 1484原创作者: pengranxiang 阅读:231次 ... -
lucene2.0+heritrix示例补充
2009-06-03 21:31 1505由于lucene2.0+heritrix一书示例用的网站( ... -
htmlparser 使用手册
2009-05-30 16:47 28792009-05-08 14:20 需要做一 ...
相关推荐
nutch配置nutch-default.xml
1.1什么是nutch..1 1.2研究nutch的原因...1 1.3 nutch的目标..1 1.4 nutch VS lucene.....2 2. nutch的安装与配置.....3 2.1 JDK的安装与配置.3 2.2 nutch的安装与配置........5 2.3 tomcat的安装与配置........
1.1什么是nutch..1 1.2研究nutch的原因...1 1.3 nutch的目标..1 1.4 nutch VS lucene.....2 2. nutch的安装与配置.....3 2.1 JDK的安装与配置.3 2.2 nutch的安装与配置........5 2.3 tomcat的安装与配置......5 3. ...
Nutch的配置文件主要有三类: 1.Hadoop的配置文件,...2.Nutch的配置文件,Nutch-default.xml和Nutch-site.xml。 3.Nutch的插件的配置文件,这些插件的配置文件在加载插件的时候由插件自行加载,如filter的配置文件。
licene 实例代码 nutch实例代码 lucene+nutch搜索引擎开发实例代码(王学松版)
nutch2.2.1安装步骤,需要自己下载以下软件: apache-ant-1.10.5-bin.tar.gz apache-nutch-2.2.1-src.tar.gz apache-tomcat-8.5.39.tar.gz jdk-8u201-linux-x64.tar.gz solr-4.10.3.zip
nutch爬虫系统分析.doc
nutcher 是 Apache Nutch 的中文教程,在github上托管。nutch社区目前缺少教程和文档,而且教程对应版本号较为落后。nutcher致力于为nutch提供一个较新的中文教程和文档,供开发者学习。 github地址: ...
毕业论文-nutch爬虫系统分析.doc
NUTCH安装步骤.NUTCH安装步骤.NUTCH安装步骤.NUTCH安装步骤.NUTCH安装步骤.NUTCH安装步骤.NUTCH安装步骤.NUTCH安装步骤.NUTCH安装步骤.
这是本人在完全分布式环境下在Cent-OS中配置Nutch-1.1时的总结文档,但该文档适合所有Linux系统和目前各版本的nutch。 目 录 介绍 ............................................................... 2 0 集群...
apache-nutch-2.3.1-src.tar.gz
这时会Build失败,查看原因发现是因为没有org.restlet和org.restlet.ext.jackson包(因为前面ivy.xml无法解析,所以注释掉了),因此这时可以到网上下载这两个包文件,并添加到项目中。
apache-nutch-1.3 的源码包,需要的可以看下
nutch 2.2.1通过ivy.xml无法直接下载的jar包
Lucene nutch 搜索引擎开发 Part1
nutch不用安装,是个应用程序,下载后为nutch-1.6.tar.gz,双击桌面上的cygwin快捷方式;执行以下命令: $ cd D:/Downloads/Soft $ tar zxvf nutch-1.0.tar.gz 在e盘下面出现nutch-0.9文件夹说明解压成功了.然后环境...
Nutch的架构图
1. 将Nutch.war包考到Tomcat的webapps下。 部署后,进入站台目录下的WEB-INF\classes,找到“nutch-site.xml”文件,打开,向其中根节点添加: <property> <name>searcher.dir</name> <value>E:\nutch-0.9\crawl...