mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-11-29 18:58:05 +08:00
[BUG][Task] fix java task classpath (#15470)
* fix javatask bug * cover --------- Co-authored-by: 80597928 <673421862@qq.com> Co-authored-by: fuchanghai <changhaifu@apache.org>
This commit is contained in:
parent
0f7081be10
commit
bd48c99178
@ -280,7 +280,7 @@ public class JavaTask extends AbstractTask {
|
||||
if (javaParameters.isModulePath()) {
|
||||
builder.append("--module-path");
|
||||
} else {
|
||||
builder.append("--class-path");
|
||||
builder.append("-classpath");
|
||||
}
|
||||
builder.append(" ")
|
||||
.append(JavaConstants.CLASSPATH_CURRENT_DIR)
|
||||
|
@ -84,7 +84,7 @@ public class JavaTaskTest {
|
||||
String homeBinPath = JavaConstants.JAVA_HOME_VAR + File.separator + "bin" + File.separator;
|
||||
JavaTask javaTask = runJarType();
|
||||
Assertions.assertEquals(javaTask.buildJarCommand(), homeBinPath
|
||||
+ "java --class-path .:/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");
|
||||
+ "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");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +106,7 @@ public class JavaTaskTest {
|
||||
Files.delete(path);
|
||||
}
|
||||
Assertions.assertEquals(homeBinPath
|
||||
+ "javac --class-path .:/tmp/dolphinscheduler/test/executepath:/tmp/dolphinscheduler/test/executepath/opt/share/jar/resource2.jar /tmp/dolphinscheduler/test/executepath/JavaTaskTest.java",
|
||||
+ "javac -classpath .:/tmp/dolphinscheduler/test/executepath:/tmp/dolphinscheduler/test/executepath/opt/share/jar/resource2.jar /tmp/dolphinscheduler/test/executepath/JavaTaskTest.java",
|
||||
javaTask.buildJavaCompileCommand(sourceCode));
|
||||
} finally {
|
||||
Path path = Paths.get(fileName);
|
||||
@ -125,7 +125,7 @@ public class JavaTaskTest {
|
||||
@Test
|
||||
public void buildJavaCommand() throws Exception {
|
||||
String wantJavaCommand =
|
||||
"${JAVA_HOME}/bin/javac --class-path .:/tmp/dolphinscheduler/test/executepath:/tmp/dolphinscheduler/test/executepath/opt/share/jar/resource2.jar /tmp/dolphinscheduler/test/executepath/JavaTaskTest.java;${JAVA_HOME}/bin/java --class-path .:/tmp/dolphinscheduler/test/executepath:/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";
|
||||
JavaTask javaTask = runJavaType();
|
||||
String sourceCode = javaTask.buildJavaSourceContent();
|
||||
String publicClassName = javaTask.getPublicClassName(sourceCode);
|
||||
|
Loading…
Reference in New Issue
Block a user