1、需要添加的jar:
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>6.6.0</version>
</dependency>
<!--对分词索引查询解析-->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>6.6.0</version>
</dependency>
<!--一般分词器,适用于英文分词-->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<version>6.6.0</version>
</dependency>
<!--中文分词器-->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-smartcn</artifactId>
<version>6.6.0</version>
</dependency>
2、maven执行的语句,下面代码的Dfile为jar的本地路径,DgroupId为上面代码的groupId,DartifactId为上面代码的artifactId,Dversion为上面代码的version:
mvn install:install-file -Dfile=F:\lucene-6.6.0\core\lucene-core-6.6.0.jar -DgroupId=org.apache.lucene -DartifactId=lucene-core -Dversion=6.6.0 -Dpackaging=jar
mvn install:install-file -Dfile=F:\lucene-6.6.0\queryparser\lucene-queryparser-6.6.0.jar -DgroupId=org.apache.lucene -DartifactId=lucene-queryparser -Dversion=6.6.0 -Dpackaging=jar
mvn install:install-file -Dfile=F:\lucene-6.6.0\analysis\common\lucene-analyzers-common-6.6.0.jar -DgroupId=org.apache.lucene -DartifactId=lucene-analyzers-common -Dversion=6.6.0 -Dpackaging=jar
mvn install:install-file -Dfile=F:\lucene-6.6.0\analysis\smartcn\lucene-analyzers-smartcn-6.6.0.jar -DgroupId=org.apache.lucene -DartifactId=lucene-analyzers-smartcn -Dversion=6.6.0 -Dpackaging=jar