2007年4月17日

Build Lucene 2.1.0 from scratch under Linux

In this Linux version, all operations are excecuted by command line.
And I will also give a Windows version build.
The build process on Windows can be finished the same as on Linux using command line. But I will show how to get the last result using Eclipse and Ant integrated with Eclipse.

Main steps:
1、Download JDK from http://java.sun.com/
2、Install JDK.
3、Download source code Lucene 2.1.0 from its official site: http://lucene.apache.org/
4、Extract files from archieve package.
tar -zxvf lucene-2.1.0.tar.gz

5、Got build tool Ant from http://ant.apache.org/

if you already have an old version of Ant(before 1.6.2, like 1.5.2-23), the build process will be failed. The error message is:
BUILD FAILED
file:/usr/home/test/code/lucene-2.1.0/build.xml:7: Unexpected element "import"
please use "ant -v " to check your ant version.

The lastest Ant version is 1.7.0, I download the zip file and use it to show how to finish the left build steps.
wget http://apache.mirrors.redwire.net/ant/binaries/apache-ant-1.7.0-bin.zip
unzip
apache-ant-1.7.0-bin.zip

Now, It's time to build! Change your directory to lucene directory: /usr/home/test/code/lucene-2.1.0
For instance, ant is under the code directory. use command
../apache-ant-1.7.0/bin/ant

If no exception ,you will got the following messages:
Buildfile: build.xml

javacc-uptodate-check:

javacc-notice:

init:

clover.setup:

clover.info:
[echo]
[echo] Clover not found. Code coverage reports disabled.
[echo]

clover:

common.compile-core:
[mkdir] Created dir: /usr/home/test/code/lucene-2.1.0/build/classes/java
[javac] Compiling 204 source files to /usr/home/wuxing/code/lucene-2.1.0/build/classes/java
[javac] Note: * uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.

compile-core:
[rmic] RMI Compiling 1 class to /usr/home/test/code/lucene-2.1.0/build/classes/java

jar-core:
[jar] Building jar: /usr/home/test/code/lucene-2.1.0/build/lucene-core-2.1.1-dev.jar

default:

BUILD SUCCESSFUL
Total time: 10 seconds



Easy? Are you got it,haha

没有评论: