This is an automated email from the ASF dual-hosted git repository.

wenjun pushed a commit to branch 3.2.2-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/3.2.2-prepare by this push:
     new 1e3bbfce77 [Fix-16211] Remove ExecutePath in buildJarCommand to fix 
Java Task in Jar Mode (#16238) (#16241)
1e3bbfce77 is described below

commit 1e3bbfce77c7cc3c72c6f58ab775af1008ec5a81
Author: Wenjun Ruan <[email protected]>
AuthorDate: Sat Jun 29 18:00:33 2024 +0800

    [Fix-16211] Remove ExecutePath in buildJarCommand to fix Java Task in Jar 
Mode (#16238) (#16241)
    
    (cherry picked from commit d42ac96c5598b9e4218cdb47f5ed98ea797f7c47)
    
    Co-authored-by: blink <[email protected]>
---
 .../dolphinscheduler/plugin/task/java/JavaTask.java    |  2 --
 .../plugin/task/java/JavaTaskTest.java                 | 18 ++++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-java/src/main/java/org/apache/dolphinscheduler/plugin/task/java/JavaTask.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-java/src/main/java/org/apache/dolphinscheduler/plugin/task/java/JavaTask.java
index fc23260345..6423452a58 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-java/src/main/java/org/apache/dolphinscheduler/plugin/task/java/JavaTask.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-java/src/main/java/org/apache/dolphinscheduler/plugin/task/java/JavaTask.java
@@ -17,7 +17,6 @@
 
 package org.apache.dolphinscheduler.plugin.task.java;
 
-import static 
org.apache.dolphinscheduler.common.constants.Constants.FOLDER_SEPARATOR;
 import static 
org.apache.dolphinscheduler.plugin.task.java.JavaConstants.JAVA_HOME_VAR;
 import static 
org.apache.dolphinscheduler.plugin.task.java.JavaConstants.PUBLIC_CLASS_NAME_REGEX;
 
@@ -187,7 +186,6 @@ public class JavaTask extends AbstractTask {
                 .append("java").append(" ")
                 .append(buildResourcePath()).append(" ")
                 .append("-jar").append(" ")
-                .append(taskRequest.getExecutePath()).append(FOLDER_SEPARATOR)
                 .append(mainJarAbsolutePathInLocal).append(" ")
                 .append(javaParameters.getMainArgs().trim()).append(" ")
                 .append(javaParameters.getJvmArgs().trim());
diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-java/src/test/java/org/apache/dolphinscheduler/plugin/task/java/JavaTaskTest.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-java/src/test/java/org/apache/dolphinscheduler/plugin/task/java/JavaTaskTest.java
index c829415326..b8af840c69 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-java/src/test/java/org/apache/dolphinscheduler/plugin/task/java/JavaTaskTest.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-java/src/test/java/org/apache/dolphinscheduler/plugin/task/java/JavaTaskTest.java
@@ -85,7 +85,7 @@ public class JavaTaskTest {
         JavaTask javaTask = runJarType();
         assertThat(javaTask.buildJarCommand())
                 .isEqualTo(
-                        "${JAVA_HOME}/bin/java -classpath 
.:/tmp/dolphinscheduler/test/executepath:opt/share/jar/resource2.jar -jar 
/tmp/dolphinscheduler/test/executepath/opt/share/jar/main.jar -host 127.0.0.1 
-port 8080 -xms:50m");
+                        "${JAVA_HOME}/bin/java -classpath 
.:/tmp/dolphinscheduler/test/executepath:/tmp/dolphinscheduler/test/executepath/opt/share/jar/resource2.jar
 -jar /tmp/dolphinscheduler/test/executepath/opt/share/jar/main.jar -host 
127.0.0.1 -port 8080 -xms:50m");
     }
 
     /**
@@ -107,7 +107,7 @@ public class JavaTaskTest {
             }
             assertThat(javaTask.buildJavaCompileCommand(sourceCode))
                     .isEqualTo(
-                            "${JAVA_HOME}/bin/javac -classpath 
.:/tmp/dolphinscheduler/test/executepath:opt/share/jar/resource2.jar 
/tmp/dolphinscheduler/test/executepath/JavaTaskTest.java");
+                            "${JAVA_HOME}/bin/javac -classpath 
.:/tmp/dolphinscheduler/test/executepath:/tmp/dolphinscheduler/test/executepath/opt/share/jar/resource2.jar
 /tmp/dolphinscheduler/test/executepath/JavaTaskTest.java");
         } finally {
             Path path = Paths.get(fileName);
             if (Files.exists(path)) {
@@ -137,7 +137,7 @@ public class JavaTaskTest {
         }
         assertThat(javaTask.buildJavaCommand())
                 .isEqualTo(
-                        "${JAVA_HOME}/bin/javac -classpath 
.:/tmp/dolphinscheduler/test/executepath:opt/share/jar/resource2.jar 
/tmp/dolphinscheduler/test/executepath/JavaTaskTest.java;${JAVA_HOME}/bin/java 
-classpath .:/tmp/dolphinscheduler/test/executepath:opt/share/jar/resource2.jar 
JavaTaskTest -host 127.0.0.1 -port 8080 -xms:50m");
+                        "${JAVA_HOME}/bin/javac -classpath 
.:/tmp/dolphinscheduler/test/executepath:/tmp/dolphinscheduler/test/executepath/opt/share/jar/resource2.jar
 /tmp/dolphinscheduler/test/executepath/JavaTaskTest.java;${JAVA_HOME}/bin/java 
-classpath 
.:/tmp/dolphinscheduler/test/executepath:/tmp/dolphinscheduler/test/executepath/opt/share/jar/resource2.jar
 JavaTaskTest -host 127.0.0.1 -port 8080 -xms:50m");
     }
 
     /**
@@ -254,15 +254,16 @@ public class JavaTaskTest {
         taskExecutionContext.setTaskAppId("runJavaType");
         ResourceContext.ResourceItem resourceItem1 = new 
ResourceContext.ResourceItem();
         
resourceItem1.setResourceAbsolutePathInStorage("/opt/share/jar/resource2.jar");
-        
resourceItem1.setResourceAbsolutePathInLocal("opt/share/jar/resource2.jar");
+        resourceItem1
+                
.setResourceAbsolutePathInLocal("/tmp/dolphinscheduler/test/executepath/opt/share/jar/resource2.jar");
 
         ResourceContext.ResourceItem resourceItem2 = new 
ResourceContext.ResourceItem();
         
resourceItem2.setResourceAbsolutePathInStorage("/opt/share/jar/main.jar");
-        resourceItem2.setResourceAbsolutePathInLocal("opt/share/jar/main.jar");
+        
resourceItem2.setResourceAbsolutePathInLocal("/tmp/dolphinscheduler/test/executepath/opt/share/jar/main.jar");
 
         ResourceContext.ResourceItem resourceItem3 = new 
ResourceContext.ResourceItem();
         resourceItem3.setResourceAbsolutePathInStorage("/JavaTaskTest.java");
-        resourceItem3.setResourceAbsolutePathInLocal("JavaTaskTest.java");
+        
resourceItem3.setResourceAbsolutePathInLocal("/tmp/dolphinscheduler/test/executepath/JavaTaskTest.java");
 
         ResourceContext resourceContext = new ResourceContext();
         resourceContext.addResourceItem(resourceItem1);
@@ -286,11 +287,12 @@ public class JavaTaskTest {
         taskExecutionContext.setTaskAppId("runJavaType");
         ResourceContext.ResourceItem resourceItem1 = new 
ResourceContext.ResourceItem();
         
resourceItem1.setResourceAbsolutePathInStorage("/opt/share/jar/resource2.jar");
-        
resourceItem1.setResourceAbsolutePathInLocal("opt/share/jar/resource2.jar");
+        resourceItem1
+                
.setResourceAbsolutePathInLocal("/tmp/dolphinscheduler/test/executepath/opt/share/jar/resource2.jar");
 
         ResourceContext.ResourceItem resourceItem2 = new 
ResourceContext.ResourceItem();
         
resourceItem2.setResourceAbsolutePathInStorage("/opt/share/jar/main.jar");
-        resourceItem2.setResourceAbsolutePathInLocal("opt/share/jar/main.jar");
+        
resourceItem2.setResourceAbsolutePathInLocal("/tmp/dolphinscheduler/test/executepath/opt/share/jar/main.jar");
 
         ResourceContext resourceContext = new ResourceContext();
         resourceContext.addResourceItem(resourceItem1);

Reply via email to