How to transform canal project open source packages and resolve anomalies

To use the canal project because the search index elasticsearch incremental update, and download client-adapter (client adapter's) default only supports the 6.4 version elasticsearch, but used in the project elasticsearch version is 7.3, in order to unify version of client-adapter transformation

First, choose the canal-master project open client-adapter module and wait for the update maven good dependence on older versions of three elasticsearch in pom file to adjust

Here Insert Picture Description

Second, repackaged at the root canal-master of: mvn clean package -DskipTests

If the compiler error No Compiler Environment IS Provided in the this , open the directory in the bin directory mvn.cmd maven input file in the first line of the file set JAVA_HOME = C: \ Program Files \ Java \ jdk1.8.0_191 ( here is where the JDK path)

[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

Third, resolve exceptions canal-adapter upgrade process

Compile Tip: ESAdapter.java: [225,56] incompatible types, can not be converted to long
Here Insert Picture Description

[ERROR] /canal-master/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/ESAdapter.java:[225,56] 不兼容的类型: or
g.apache.lucene.search.TotalHits无法转换为long

Here Insert Picture Description
Solution: Increase the value after getTotalHits, because ES7 enlarged the scope of TotalHits
Here Insert Picture Description
adjusted continue compiler package mvn package -DskipTests, can be directly compiled to continue in the wrong place just waiting compiled, and then directly use the compiled client-adapter
Here Insert Picture Description

Published 132 original articles · won praise 52 · views 70000 +

Guess you like

Origin blog.csdn.net/loulanyue_/article/details/104469125