fix #2634 download modules files

This commit is contained in:
Shinsuke Sugaya 2022-03-17 10:48:33 +09:00
parent 6d31369d53
commit da88b7b7c8
5 changed files with 203 additions and 13 deletions

3
.gitignore vendored
View file

@ -28,10 +28,11 @@
.vscode
.DS_Store
/plugins/
/modules/
/tomcat.8080/
dbflute_fess/output/doc/lastadoc-fess.html
dbflute_fess/schema/project-lastadoc-fess.json
src/main/resources/fess_indices/.fess_config.access_token/access_token.bulk
src/main/resources/fess_indices/fess_config.access_token/access_token.bulk
src/main/resources/ga_client_secrets.p12
src/main/webapp/WEB-INF/project.properties
/.apt_generated/

107
module.xml Normal file
View file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="module" basedir=".">
<property name="modules.dir" value="${basedir}/modules" />
<property name="target.dir" value="${basedir}/target/modules" />
<!-- Maven Repository -->
<property name="maven.snapshot.repo.url" value="https://maven.codelibs.org/" />
<property name="maven.release.repo.url" value="https://maven.codelibs.org/" />
<property name="opensearch.version" value="1.2.4" />
<target name="install.modules">
<mkdir dir="${target.dir}" />
<delete dir="${modules.dir}" />
<mkdir dir="${modules.dir}" />
<!-- analysis-common -->
<antcall target="install.module">
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="module.groupId" value="org/codelibs/opensearch" />
<param name="module.name.prefix" value="" />
<param name="module.name" value="analysis-common" />
<param name="module.version" value="${opensearch.version}" />
<param name="module.zip.version" value="${opensearch.version}" />
</antcall>
<!-- geo -->
<antcall target="install.module">
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="module.groupId" value="org/codelibs/opensearch" />
<param name="module.name.prefix" value="" />
<param name="module.name" value="geo" />
<param name="module.version" value="${opensearch.version}" />
<param name="module.zip.version" value="${opensearch.version}" />
</antcall>
<!-- lang-expression -->
<antcall target="install.module">
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="module.groupId" value="org/codelibs/opensearch" />
<param name="module.name.prefix" value="" />
<param name="module.name" value="lang-expression" />
<param name="module.version" value="${opensearch.version}" />
<param name="module.zip.version" value="${opensearch.version}" />
</antcall>
<!-- lang-painless -->
<antcall target="install.module">
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="module.groupId" value="org/codelibs/opensearch" />
<param name="module.name.prefix" value="" />
<param name="module.name" value="lang-painless" />
<param name="module.version" value="${opensearch.version}" />
<param name="module.zip.version" value="${opensearch.version}" />
</antcall>
<!-- mapper-extras -->
<antcall target="install.module">
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="module.groupId" value="org/codelibs/opensearch" />
<param name="module.name.prefix" value="" />
<param name="module.name" value="mapper-extras" />
<param name="module.version" value="${opensearch.version}" />
<param name="module.zip.version" value="${opensearch.version}" />
</antcall>
<!-- reindex -->
<antcall target="install.module">
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="module.groupId" value="org/codelibs/opensearch" />
<param name="module.name.prefix" value="" />
<param name="module.name" value="reindex" />
<param name="module.version" value="${opensearch.version}" />
<param name="module.zip.version" value="${opensearch.version}" />
</antcall>
<!-- transport-netty4 -->
<antcall target="install.module">
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="module.groupId" value="org/codelibs/opensearch" />
<param name="module.name.prefix" value="" />
<param name="module.name" value="transport-netty4" />
<param name="module.version" value="${opensearch.version}" />
<param name="module.zip.version" value="${opensearch.version}" />
</antcall>
<antcall target="remove.jars" />
</target>
<target name="install.module">
<get dest="${target.dir}">
<url url="${repo.url}/${module.groupId}/${module.name.prefix}${module.name}/${module.version}/${module.name.prefix}${module.name}-${module.zip.version}.zip" />
</get>
<unzip dest="${modules.dir}/${module.name}" src="${target.dir}/${module.name.prefix}${module.name}-${module.zip.version}.zip">
<patternset>
<include name="**" />
</patternset>
<cutdirsmapper dirs="1" />
</unzip>
</target>
<target name="remove.jars" if="with.fess">
<delete>
<fileset dir="${modules.dir}">
<include name="lang-expression/asm-*" />
<include name="lang-painless/asm-*" />
<include name="reindex/commons-codec-*" />
<include name="reindex/commons-logging-*" />
<include name="reindex/httpclient-*" />
<include name="reindex/httpcore-4*" />
</fileset>
</delete>
</target>
</project>

View file

@ -6,8 +6,6 @@
<!-- Maven Repository -->
<property name="maven.snapshot.repo.url" value="https://oss.sonatype.org/content/repositories/snapshots" />
<property name="maven.release.repo.url" value="https://oss.sonatype.org/content/repositories/releases" />
<property name="use.opensearch" value="" />
<property name="name.prefix" value="elasticsearch" />
<target name="install.plugins">
<mkdir dir="${target.dir}" />
@ -16,8 +14,8 @@
<!-- analysis-extension -->
<antcall target="install.plugin">
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="plugin.groupId" value="org/codelibs${use.opensearch}" />
<param name="plugin.name.prefix" value="${name.prefix}-" />
<param name="plugin.groupId" value="org/codelibs/opensearch" />
<param name="plugin.name.prefix" value="opensearch-" />
<param name="plugin.name" value="analysis-extension" />
<param name="plugin.version" value="1.2.0" />
<param name="plugin.zip.version" value="1.2.0" />
@ -25,8 +23,8 @@
<!-- analysis-fess -->
<antcall target="install.plugin">
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="plugin.groupId" value="org/codelibs${use.opensearch}" />
<param name="plugin.name.prefix" value="${name.prefix}-" />
<param name="plugin.groupId" value="org/codelibs/opensearch" />
<param name="plugin.name.prefix" value="opensearch-" />
<param name="plugin.name" value="analysis-fess" />
<param name="plugin.version" value="1.2.0" />
<param name="plugin.zip.version" value="1.2.0" />
@ -34,8 +32,8 @@
<!-- configsync -->
<antcall target="install.plugin">
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="plugin.groupId" value="org/codelibs${use.opensearch}" />
<param name="plugin.name.prefix" value="${name.prefix}-" />
<param name="plugin.groupId" value="org/codelibs/opensearch" />
<param name="plugin.name.prefix" value="opensearch-" />
<param name="plugin.name" value="configsync" />
<param name="plugin.version" value="1.2.1" />
<param name="plugin.zip.version" value="1.2.1" />
@ -43,8 +41,8 @@
<!-- minhash -->
<antcall target="install.plugin">
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="plugin.groupId" value="org/codelibs${use.opensearch}" />
<param name="plugin.name.prefix" value="${name.prefix}-" />
<param name="plugin.groupId" value="org/codelibs/opensearch" />
<param name="plugin.name.prefix" value="opensearch-" />
<param name="plugin.name" value="minhash" />
<param name="plugin.version" value="1.2.0" />
<param name="plugin.zip.version" value="1.2.0" />

82
pom.xml
View file

@ -213,10 +213,12 @@
<configuration>
<target>
<ant antfile="${basedir}/dbflute.xml" target="download.dbflute" />
<ant antfile="${basedir}/module.xml" target="install.modules">
<property name="with.fess" value="true" />
<property name="opensearch.version" value="${opensearch.version}" />
</ant>
<ant antfile="${basedir}/plugin.xml" target="install.plugins">
<property name="with.fess" value="true" />
<property name="use.opensearch" value="/opensearch" />
<property name="name.prefix" value="opensearch" />
</ant>
<ant antfile="deps.xml" target="install.jars" />
<echo message="fess.version=${project.version}" file="${basedir}/src/main/webapp/WEB-INF/project.properties" />
@ -501,6 +503,17 @@
<group>elasticsearch</group>
</mapper>
</data>
<!-- Add elasicsearch modules directory -->
<data>
<type>directory</type>
<src>${project.basedir}/modules</src>
<mapper>
<type>perm</type>
<prefix>${packaging.fess.home.dir}/es/modules</prefix>
<user>${packaging.fess.user}</user>
<group>${packaging.fess.group}</group>
</mapper>
</data>
<!-- Add elasicsearch plugins directory -->
<data>
<type>directory</type>
@ -744,6 +757,15 @@
<username>elasticsearch</username>
<groupname>elasticsearch</groupname>
</mapping>
<!-- es/modules -->
<mapping>
<directory>${packaging.fess.home.dir}/es/modules</directory>
<sources>
<source>
<location>${project.basedir}/modules</location>
</source>
</sources>
</mapping>
<!-- es/plugins -->
<mapping>
<directory>${packaging.fess.home.dir}/es/plugins</directory>
@ -1003,6 +1025,62 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>repository-url</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>percolator-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>reindex-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>mapper-extras-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>aggs-matrix-stats-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>rank-eval-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>lang-expression</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>ingest-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>ingest-user-agent</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>lang-mustache-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>lang-painless</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>parent-join-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>transport-netty4-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensearch.plugin</groupId>
<artifactId>analysis-common</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>

View file

@ -260,6 +260,12 @@ public class SearchEngineClient implements Client {
}
config.disableESLogger();
runner.onBuild((number, settingsBuilder) -> {
final File moduleDir = new File(esDir, "modules");
if (moduleDir.isDirectory()) {
settingsBuilder.put("path.modules", moduleDir.getAbsolutePath());
} else {
settingsBuilder.put("path.modules", new File(System.getProperty("user.dir"), "modules").getAbsolutePath());
}
final File pluginDir = new File(esDir, "plugins");
if (pluginDir.isDirectory()) {
settingsBuilder.put("path.plugins", pluginDir.getAbsolutePath());