This is an automated email from the ASF dual-hosted git repository.
davidzollo pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new ac89062f1f [Fix][Transform-V2] Align Scala compiler with Spark Scala
version (#11117)
ac89062f1f is described below
commit ac89062f1f881975319e19fe0b69633da7c13b69
Author: Jast <[email protected]>
AuthorDate: Mon Jun 22 21:04:35 2026 +0800
[Fix][Transform-V2] Align Scala compiler with Spark Scala version (#11117)
---
.../api/ScalaCompilerVersionCheckTest.java | 97 ++++++++++++++++++++++
seatunnel-shade/seatunnel-scala-compiler/pom.xml | 5 --
.../dynamiccompile/parse/ScalaClassParser.java | 3 +-
tools/dependencies/known-dependencies.txt | 8 +-
4 files changed, 101 insertions(+), 12 deletions(-)
diff --git
a/seatunnel-ci-tools/src/test/java/org/apache/seatunnel/api/ScalaCompilerVersionCheckTest.java
b/seatunnel-ci-tools/src/test/java/org/apache/seatunnel/api/ScalaCompilerVersionCheckTest.java
new file mode 100644
index 0000000000..ddf110a4cf
--- /dev/null
+++
b/seatunnel-ci-tools/src/test/java/org/apache/seatunnel/api/ScalaCompilerVersionCheckTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+
+package org.apache.seatunnel.api;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import java.io.File;
+
+public class ScalaCompilerVersionCheckTest {
+
+ @Test
+ public void testScalaCompilerModuleUsesRootScalaVersion() throws Exception
{
+ File scalaCompilerPom = new
File("../seatunnel-shade/seatunnel-scala-compiler/pom.xml");
+ Document pom = parsePom(scalaCompilerPom);
+
+ Assertions.assertFalse(
+ hasDirectProperty(pom, "scala.version"),
+ "seatunnel-scala-compiler must inherit scala.version from root
pom.xml");
+ Assertions.assertFalse(
+ hasDirectProperty(pom, "scala.binary.version"),
+ "seatunnel-scala-compiler must inherit scala.binary.version
from root pom.xml");
+ Assertions.assertEquals(
+ "${scala.version}",
+ findDependencyVersion(pom, "org.scala-lang", "scala-compiler"),
+ "scala-compiler dependency must track the root scala.version
property");
+ }
+
+ private Document parsePom(File pomFile) throws Exception {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl",
true);
+
factory.setFeature("http://xml.org/sax/features/external-general-entities",
false);
+
factory.setFeature("http://xml.org/sax/features/external-parameter-entities",
false);
+ factory.setNamespaceAware(false);
+ return factory.newDocumentBuilder().parse(pomFile);
+ }
+
+ private boolean hasDirectProperty(Document pom, String propertyName) {
+ NodeList properties = pom.getDocumentElement().getChildNodes();
+ for (int i = 0; i < properties.getLength(); i++) {
+ Node node = properties.item(i);
+ if ("properties".equals(node.getNodeName())) {
+ NodeList children = node.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ if (propertyName.equals(children.item(j).getNodeName())) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private String findDependencyVersion(Document pom, String groupId, String
artifactId) {
+ NodeList dependencies = pom.getElementsByTagName("dependency");
+ for (int i = 0; i < dependencies.getLength(); i++) {
+ Node dependency = dependencies.item(i);
+ if (groupId.equals(childText(dependency, "groupId"))
+ && artifactId.equals(childText(dependency, "artifactId")))
{
+ return childText(dependency, "version");
+ }
+ }
+ Assertions.fail("Dependency not found: " + groupId + ":" + artifactId);
+ return null;
+ }
+
+ private String childText(Node node, String childName) {
+ NodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (childName.equals(child.getNodeName())) {
+ return child.getTextContent().trim();
+ }
+ }
+ return null;
+ }
+}
diff --git a/seatunnel-shade/seatunnel-scala-compiler/pom.xml
b/seatunnel-shade/seatunnel-scala-compiler/pom.xml
index 58b8d9bfd2..c3d3878d5b 100644
--- a/seatunnel-shade/seatunnel-scala-compiler/pom.xml
+++ b/seatunnel-shade/seatunnel-scala-compiler/pom.xml
@@ -26,11 +26,6 @@
<artifactId>seatunnel-scala-compiler</artifactId>
<name>SeaTunnel : Shade : Scala</name>
- <properties>
- <scala.version>2.13.11</scala.version>
- <scala.binary.version>2.13</scala.binary.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
diff --git
a/seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/dynamiccompile/parse/ScalaClassParser.java
b/seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/dynamiccompile/parse/ScalaClassParser.java
index e50289d903..042e5080ce 100644
---
a/seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/dynamiccompile/parse/ScalaClassParser.java
+++
b/seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/dynamiccompile/parse/ScalaClassParser.java
@@ -18,7 +18,6 @@ package org.apache.seatunnel.transform.dynamiccompile.parse;
import org.apache.seatunnel.shade.scala.tools.nsc.Settings;
import org.apache.seatunnel.shade.scala.tools.nsc.interpreter.IMain;
-import
org.apache.seatunnel.shade.scala.tools.nsc.interpreter.shell.ReplReporterImpl;
import org.apache.seatunnel.transform.exception.TransformException;
@@ -38,7 +37,7 @@ public class ScalaClassParser extends AbstractParser {
try {
Settings settings = new Settings();
settings.usejavacp().v_$eq(true);
- scalaInterpreter = new IMain(settings, new
ReplReporterImpl(settings));
+ scalaInterpreter = new IMain(settings);
} catch (Exception e) {
throw new TransformException(COMPILE_TRANSFORM_ERROR_CODE,
e.getMessage());
}
diff --git a/tools/dependencies/known-dependencies.txt
b/tools/dependencies/known-dependencies.txt
index efc70e55f5..e64fc4d6ed 100755
--- a/tools/dependencies/known-dependencies.txt
+++ b/tools/dependencies/known-dependencies.txt
@@ -27,8 +27,9 @@ protostuff-collectionschema-1.8.0.jar
protostuff-core-1.8.0.jar
protostuff-runtime-1.8.0.jar
scala-library-2.12.15.jar
-scala-compiler-2.13.11.jar
-scala-reflect-2.13.11.jar
+scala-compiler-2.12.15.jar
+scala-reflect-2.12.15.jar
+scala-xml_2.12-1.0.6.jar
seatunnel-scala-compiler-3.0.0-SNAPSHOT-optional.jar
seatunnel-jackson-3.0.0-SNAPSHOT-optional.jar
seatunnel-guava-3.0.0-SNAPSHOT-optional.jar
@@ -76,7 +77,6 @@ jetty-util-9.4.56.v20240826.jar
jetty-util-ajax-9.4.56.v20240826.jar
javax.servlet-api-3.1.0.jar
seatunnel-jetty9-9.4.56-3.0.0-SNAPSHOT-optional.jar
-jna-5.13.0.jar
jna-5.15.0.jar
jna-platform-5.15.0.jar
oshi-core-6.6.5.jar
@@ -128,5 +128,3 @@ netty-common-4.1.118.Final.jar
netty-handler-4.1.118.Final.jar
netty-resolver-4.1.118.Final.jar
eventstream-1.0.1.jar
-java-diff-utils-4.12.jar
-jline-3.22.0.jar