下载lucene
https://github.com/YallZhang/lucene-solr
版本8.8.2
D:\03.git\ES中台\lucene-solr-8.8.2
安装ant
1.下载https://ant.apache.org/bindownload.cgi
版本:1.10.12
2.解压到:D:\apache-ant-1.10.12
3.配置环境变量:ANT_HOME=D:\apache-ant-1.10.12
PATH增加:%ANT_HOME%\bin
4.验证ant安装
cmd执行
ant -version
输出:Apache Ant(TM) version 1.10.12 compiled on October 13 2021
JAVA_HOME也需要配置
安装ivy
http://archive.apache.org/dist/ant/ivy/
1.下载:apache-ivy-2.4.0.zip
2.解压到:D:\apache-ant-1.10.12\apache-ivy-2.4.0
3.拷贝D:\apache-ant-1.10.12\apache-ivy-2.4.0目录下的ivy-2.4.0.jar 文件到 ant安装目录下的lib文件夹D:\apache-ant-1.10.12\lib
4.配置环境变量IVY_HOME=D:\apache-ant-1.10.12\apache-ivy-2.4.0
5.配置maven地址
${user.home}/.ivy2/ivysettings.xml
<ivy-settings>
<!-- set resolver chain as default -->
<settings defaultResolver="main" />
<!-- configure caches -->
<caches repositoryCacheDir="${user.home}/.ivy2/cache">
<!-- do not cache from local .m2-->
<cache name="nocache" useOrigin="true" />
<cache name="default" />
</caches>
<resolvers>
<chain name="main">
<ibiblio name="repomanager" m2compatible="true"
root="https://maven.aliyun.com/repository/central/" cache="default"/>
</chain>
</resolvers>
</ivy-settings>
导入lucene
1.cmd进入D:\03.git\ES中台\lucene-solr-8.8.2
2.ant idea
等待Build Successful之后即可生成idea能识别的文件:parent.iml、.idea、idea-build等。
ant idea这一过程会及其漫长,主要是因为ivy要下载很多jar包到本地仓库C:\Users\userName\.ivy2\cache中,如果这一过程中出现卡顿或者Build Failed,就去maven repository手动下载对应版本的jar包放到ivy仓库对应的目录下,之后重新执行ant idea即可,直至Build Successful。
或者手动拷贝地址到浏览器下载对应jar包,然后拷贝放到C:\Users\userName\.ivy2\cache。重新执行ant idea
3.ant idea执行完毕后打开idea->File->Open lucene和solr源码共同的根目录即可,同时导入lucene和solr。导入之后配置项目的SDK:File->Project Settins->SDKs 设置1.8
4.lucene-solr-8.8.2\lucene\core\ivy.xml 添加zstd依赖
<ivy-module version="2.0">
<info organisation="org.apache.lucene" module="core"/>
<configurations defaultconfmapping="compile->master">
<conf name="compile" transitive="false"/>
</configurations>
<dependencies>
<!-- zstd-jni -->
<dependency org="com.github.luben" name="zstd-jni" rev="1.5.0-4" conf="compile"/>
</dependencies>
</ivy-module>
5.cmd下执行 ant compile
D:\03.git\ES中台\lucene-solr-8.8.2\lucene\build\core找到lucene-core-8.8.2.jar
拷贝到lucene-core-8.8.2.jar到maven的lucene目录D:\01.develop\repo\org\apache\lucene\lucene-core\8.8.2
其他:
ant+ivy依赖管理:https://blog.csdn.net/lanxiangru/article/details/62479407
idea导入lucene:https://www.jianshu.com/p/90d84bf93d57