diff --git a/iotdb-core/calc-commons/pom.xml b/iotdb-core/calc-commons/pom.xml
index baa6d16bad44..55d551afac49 100644
--- a/iotdb-core/calc-commons/pom.xml
+++ b/iotdb-core/calc-commons/pom.xml
@@ -181,25 +181,6 @@
-
-
- org.apache.drill.tools
- drill-fmpp-maven-plugin
-
-
- generate-fmpp
-
- generate
-
- generate-sources
-
- ${project.build.directory}/codegen/config.fmpp
-
- ${project.build.directory}/codegen/templates
-
-
-
-
org.codehaus.mojo
build-helper-maven-plugin
diff --git a/iotdb-core/datanode/pom.xml b/iotdb-core/datanode/pom.xml
index b615061fc745..6ce942b542a6 100644
--- a/iotdb-core/datanode/pom.xml
+++ b/iotdb-core/datanode/pom.xml
@@ -419,25 +419,6 @@
-
-
- org.apache.drill.tools
- drill-fmpp-maven-plugin
-
-
- generate-fmpp
-
- generate
-
- generate-sources
-
- ${project.build.directory}/codegen/config.fmpp
-
- ${project.build.directory}/codegen/templates
-
-
-
-
org.codehaus.mojo
build-helper-maven-plugin
@@ -450,7 +431,6 @@
generate-sources
- ${project.build.directory}/generated-sources/freemarker
${project.basedir}/src/main/i18n/${i18n.locale}
diff --git a/iotdb-protocol/thrift-ainode/pom.xml b/iotdb-protocol/thrift-ainode/pom.xml
index eee0a3762534..dbb7db13332d 100644
--- a/iotdb-protocol/thrift-ainode/pom.xml
+++ b/iotdb-protocol/thrift-ainode/pom.xml
@@ -29,6 +29,9 @@
iotdb-thrift-ainode
IoTDB: Protocol: Thrift AI Node
RPC (Thrift) framework among AINodes.
+
+ ainode.thrift
+
org.slf4j
@@ -44,26 +47,4 @@
2.0.11-SNAPSHOT
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
-
- add-source
-
- add-source
-
- generate-sources
-
-
- ${project.build.directory}/generated-sources/thrift
-
-
-
-
-
-
-
diff --git a/iotdb-protocol/thrift-commons/pom.xml b/iotdb-protocol/thrift-commons/pom.xml
index 4438a3706fc1..2610823cd974 100644
--- a/iotdb-protocol/thrift-commons/pom.xml
+++ b/iotdb-protocol/thrift-commons/pom.xml
@@ -29,32 +29,14 @@
iotdb-thrift-commons
IoTDB: Protocol: Thrift Commons
RPC (Thrift) common framework.
+
+ common.thrift
+ false
+
org.apache.thrift
libthrift
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
-
- add-source
-
- add-source
-
- generate-sources
-
-
- ${project.build.directory}/generated-sources/thrift
-
-
-
-
-
-
-
diff --git a/iotdb-protocol/thrift-confignode/pom.xml b/iotdb-protocol/thrift-confignode/pom.xml
index b13d2a6d80b7..04b853e7d26f 100644
--- a/iotdb-protocol/thrift-confignode/pom.xml
+++ b/iotdb-protocol/thrift-confignode/pom.xml
@@ -29,6 +29,9 @@
iotdb-thrift-confignode
IoTDB: Protocol: Thrift Config Node
RPC (Thrift) framework among ConfigNodes.
+
+ confignode.thrift
+
org.slf4j
@@ -44,26 +47,4 @@
2.0.11-SNAPSHOT
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
-
- add-source
-
- add-source
-
- generate-sources
-
-
- ${project.build.directory}/generated-sources/thrift
-
-
-
-
-
-
-
diff --git a/iotdb-protocol/thrift-consensus/pom.xml b/iotdb-protocol/thrift-consensus/pom.xml
index 8163f406a12c..a9208e2d3de0 100644
--- a/iotdb-protocol/thrift-consensus/pom.xml
+++ b/iotdb-protocol/thrift-consensus/pom.xml
@@ -29,6 +29,10 @@
iotdb-thrift-consensus
IoTDB: Protocol: Thrift Consensus
RPC modules for consensus
+
+ iotconsensus.thrift
+ true
+
org.apache.iotdb
@@ -48,18 +52,20 @@
org.codehaus.mojo
- build-helper-maven-plugin
+ exec-maven-plugin
- add-source
+ generate-iotconsensusv2-java
+ generate-sources
- add-source
+ exec
- generate-sources
-
- ${project.build.directory}/generated-sources/thrift
-
+
+ --gen
+ java:generated_annotations=suppress
+ ${project.basedir}/src/main/thrift/iotconsensusv2.thrift
+
diff --git a/iotdb-protocol/thrift-datanode/pom.xml b/iotdb-protocol/thrift-datanode/pom.xml
index 7d86774df2b5..3481003cc57a 100644
--- a/iotdb-protocol/thrift-datanode/pom.xml
+++ b/iotdb-protocol/thrift-datanode/pom.xml
@@ -29,6 +29,10 @@
iotdb-thrift
IoTDB: Protocol: Thrift Data Node
RPC (Thrift) framework for client and DataNodes.
+
+ client.thrift
+ false
+
org.apache.iotdb
@@ -84,18 +88,35 @@
org.codehaus.mojo
- build-helper-maven-plugin
+ exec-maven-plugin
- add-source
+ generate-datanode-java
+ generate-sources
- add-source
+ exec
+
+
+ --gen
+ java:generated_annotations=suppress
+ ${project.basedir}/src/main/thrift/datanode.thrift
+
+
+
+
+ generate-datanode-python
generate-sources
+
+ exec
+
-
- ${project.build.directory}/generated-sources/thrift
-
+ ${project.build.directory}/generated-sources-python
+
+ --gen
+ py
+ ${project.basedir}/src/main/thrift/datanode.thrift
+
diff --git a/pom.xml b/pom.xml
index 90ac0c70ce7c..6748d47530b4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,14 +70,15 @@
2.11.1
3.18.0
false
- 1.21.1
4.2.19
11.1.0
true
5.1.9
3.0.2
+ 0.9.14
3.10
+ 2.3.30
1.16
1.28.0
2.13.1
@@ -922,11 +923,6 @@
maven-dependency-plugin
3.6.0
-
- org.apache.thrift
- thrift-maven-plugin
- 0.10.0
-
com.bazaarvoice.maven.plugins
process-exec-maven-plugin
@@ -966,11 +962,6 @@
antlr4-maven-plugin
${antlr4.version}
-
- org.apache.drill.tools
- drill-fmpp-maven-plugin
- ${drill.freemarker.maven.plugin.version}
-
org.apache.maven.plugins
maven-clean-plugin
@@ -1531,12 +1522,8 @@
.thrift-generation
@@ -1547,6 +1534,9 @@
${project.build.directory}/thrift/bin/${thrift.executable}
+ false
+
+ true
@@ -1577,58 +1567,202 @@
- org.apache.thrift
- thrift-maven-plugin
+ org.codehaus.mojo
+ exec-maven-plugin
- ${thrift.exec.absolute.path}
- ${project.basedir}/src/main/thrift
+ ${thrift.exec.absolute.path}
+
+ ${project.build.directory}/generated-sources/thrift
+
+
+ -I
+ ${project.basedir}/../thrift-commons/src/main/thrift
+ -out
+ .
+
generate-thrift-sources-java
+ generate-sources
- compile
+ exec
- generate-sources
- java:generated_annotations=suppress
+
+ --gen
+ java:generated_annotations=suppress
+ ${project.basedir}/src/main/thrift/${thrift.source}
+
generate-thrift-sources-python
+ generate-sources
- compile
+ exec
- generate-sources
- py
- **/common.thrift,**/client.thrift,**/datanode.thrift,**/confignode.thrift,**/ainode.thrift
- ${project.build.directory}/generated-sources-python/
+ ${thrift.skip.python}
+ ${project.build.directory}/generated-sources-python
+
+ --gen
+ py
+ ${project.basedir}/src/main/thrift/${thrift.source}
+
generate-thrift-sources-go
+ generate-sources
- compile
+ exec
- generate-sources
- go:package_prefix=github.com/apache/iotdb-client-go/v2/
- **/common.thrift,**/client.thrift
- ${project.build.directory}/generated-sources-go
+ ${thrift.skip.client}
+ ${project.build.directory}/generated-sources-go
+
+ --gen
+ go:package_prefix=github.com/apache/iotdb-client-go/v2/
+ ${project.basedir}/src/main/thrift/${thrift.source}
+
generate-thrift-sources-csharp
+ generate-sources
- compile
+ exec
+
+ ${thrift.skip.client}
+ ${project.parent.build.directory}/generated-sources-csharp
+
+ --gen
+ netstd:no_deepcopy
+ ${project.basedir}/src/main/thrift/${thrift.source}
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+
+
+ add-source
generate-sources
+
+ add-source
+
- netstd:no_deepcopy
- **/common.thrift,**/client.thrift
-
- ${project.parent.build.directory}/generated-sources-csharp
+
+ ${project.build.directory}/generated-sources/thrift
+
+
+
+
+ add-thrift-resources
+ generate-sources
+
+ add-resource
+
+
+
+
+ ${project.basedir}/src/main/thrift
+
+ **/*.thrift
+
+
+
+
+
+
+
+
+
+
+
+ .fmpp-generation
+
+
+ src/main/codegen
+
+
+
+ ${project.build.directory}/codegen
+ ${project.build.directory}/generated-sources/freemarker
+
+
+
+
+ org.codehaus.gmaven
+ groovy-maven-plugin
+ 2.1.1
+
+
+ org.apache.groovy
+ groovy
+ 4.0.22
+
+
+ net.sourceforge.fmpp
+ fmpp
+ ${fmpp.version}
+
+
+
+ *
+ *
+
+
+
+
+ org.freemarker
+ freemarker
+ ${freemarker.version}
+
+
+
+ org.apache-extras.beanshell
+ bsh
+ 2.0b6
+
+
+ oro
+ oro
+ 2.0.8
+
+
+
+
+ generate-fmpp
+ generate-sources
+
+ execute
+
+
+ ${maven.multiModuleProjectDirectory}/src/main/groovy/generateFmpp.groovy
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+
+
+ add-fmpp-source
+ generate-sources
+
+ add-source
+
+
+
+ ${fmpp.output.directory}
+
@@ -1712,11 +1846,11 @@
org.codehaus.gmaven
groovy-maven-plugin
2.1.1
-
- false
compare-with-reference-list
+
+ false
verify
execute
diff --git a/src/main/groovy/generateFmpp.groovy b/src/main/groovy/generateFmpp.groovy
new file mode 100644
index 000000000000..d90ebae20abd
--- /dev/null
+++ b/src/main/groovy/generateFmpp.groovy
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import fmpp.setting.Settings
+
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.StandardCopyOption
+
+// Each Maven module owns its output and uses a unique temporary directory.
+def codegen = Path.of(properties['fmpp.codegen.directory'].toString()).toAbsolutePath()
+def output = Path.of(properties['fmpp.output.directory'].toString()).toAbsolutePath()
+Files.createDirectories(output)
+def temporary = Files.createTempDirectory(output.parent, 'fmpp-')
+try {
+ def settings = new Settings(codegen.toFile())
+ settings.set(Settings.NAME_SOURCE_ROOT, codegen.resolve('templates').toString())
+ settings.set(Settings.NAME_OUTPUT_ROOT, temporary.toString())
+ settings.load(codegen.resolve('config.fmpp').toFile())
+ settings.execute()
+
+ // Publish only after every template succeeds; unchanged files retain their timestamps.
+ Files.walk(temporary).withCloseable { paths ->
+ paths.filter { Files.isRegularFile(it) }.forEach { generated ->
+ def destination = output.resolve(temporary.relativize(generated))
+ if (!Files.exists(destination) || Files.mismatch(generated, destination) != -1) {
+ Files.createDirectories(destination.parent)
+ Files.move(generated, destination, StandardCopyOption.REPLACE_EXISTING)
+ }
+ }
+ }
+} finally {
+ Files.walk(temporary).withCloseable { paths ->
+ paths.sorted(Comparator.reverseOrder()).forEach { Files.delete(it) }
+ }
+}