Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DSIP-27][Task Plugin] Some improvements of JAVA task plugin #16542

Open
wants to merge 56 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
88cd3af
[Feature-15819][Task Plugin]Update the JAVA task
ailiujiarui Sep 10, 2024
014d566
Merge branch 'dev' into dev
ailiujiarui Sep 10, 2024
9e9109f
Merge branch 'dev' into dev
davidzollo Sep 23, 2024
da129ad
fix the CI bug in the JavaTaskTest.java
ailiujiarui Sep 23, 2024
f736787
fix the CI bug in the fields/use-java.ts
ailiujiarui Sep 23, 2024
f5c544d
Merge branch 'dev' into dev
ailiujiarui Sep 24, 2024
2c70aab
Standardize Code Formatting
ailiujiarui Sep 25, 2024
1e742f4
Delete the JavaTaskE2ETest
ailiujiarui Sep 26, 2024
a14332a
Merge branch 'dev' into dev
ailiujiarui Sep 26, 2024
2f938e4
Merge branch 'dev' into dev
ailiujiarui Sep 27, 2024
890cd9e
Merge branch 'dev' into dev
ailiujiarui Sep 28, 2024
c41762a
Merge branch 'dev' into dev
ailiujiarui Sep 29, 2024
bc38b84
Merge branch 'dev' into dev
ailiujiarui Oct 5, 2024
341d103
Merge branch 'dev' into dev
SbloodyS Oct 13, 2024
5f9a1db
Merge branch 'dev' into dev
ailiujiarui Oct 20, 2024
9a4d74b
Update the JavaTaskE2ETest
ailiujiarui Oct 21, 2024
851191f
Merge branch 'apache:dev' into dev
ailiujiarui Oct 21, 2024
07ac1a8
Merge remote-tracking branch 'origin/dev' into dev
ailiujiarui Oct 21, 2024
b498932
Update the code details of the JavaTask
ailiujiarui Oct 23, 2024
7c60d70
Update the code details of the JavaE2ETest
ailiujiarui Oct 24, 2024
5e0b91e
Mount the JAR files to the image
ailiujiarui Oct 24, 2024
5b328fb
Update the method of obtaining logs.
ailiujiarui Oct 24, 2024
59eddd8
Update the filePath
ailiujiarui Oct 25, 2024
dd4f2cf
Merge branch 'dev' into dev
ailiujiarui Oct 25, 2024
f54b85f
Merge branch 'dev' into dev
ailiujiarui Oct 25, 2024
164b8e9
Update the file mount path.
ailiujiarui Oct 25, 2024
6fbc4da
Update the java task docs
ailiujiarui Oct 27, 2024
577868a
Update the files mount path
ailiujiarui Oct 28, 2024
39abd7b
Delete the mounted jar
ailiujiarui Oct 28, 2024
dececfa
Add test code and implement packaging method
ailiujiarui Oct 29, 2024
b1f2250
Fix the select resource bug
ailiujiarui Oct 29, 2024
0c139c6
Update the paths of jar and class
ailiujiarui Oct 30, 2024
c0d2dd4
Update the method to get the class
ailiujiarui Oct 31, 2024
5aca65f
Merge branch 'apache:dev' into dev
ailiujiarui Oct 31, 2024
1322bcb
Update the code detail
ailiujiarui Nov 3, 2024
88d133d
Merge remote-tracking branch 'origin/dev' into dev
ailiujiarui Nov 3, 2024
f9a923f
Add the Normal jar test for WorkflowJavaTaskE2ETest
ailiujiarui Nov 3, 2024
d2651d9
Merge branch 'dev' into dev
ailiujiarui Nov 5, 2024
f740c07
Merge branch 'dev' into dev
ailiujiarui Nov 6, 2024
3651128
Merge branch 'dev' into dev
ailiujiarui Nov 6, 2024
0bb236c
Merge branch 'dev' into dev
davidzollo Nov 7, 2024
e38158b
Merge branch 'dev' into dev
ailiujiarui Nov 9, 2024
20a691b
Merge branch 'dev' into dev
SbloodyS Nov 13, 2024
e43e51e
Update the java.md docs detail
ailiujiarui Nov 13, 2024
2b8c02f
Update the MainClassExtractor code detail
ailiujiarui Nov 13, 2024
4fe3500
Merge branch 'dev' into dev
ailiujiarui Nov 14, 2024
3f16fe4
Merge branch 'dev' into dev
ailiujiarui Nov 15, 2024
4c2af8a
Merge branch 'apache:dev' into dev
ailiujiarui Nov 18, 2024
a413ef7
Fix the plugin-java unit-Test bug
ailiujiarui Nov 18, 2024
3e9fadb
Merge branch 'apache:dev' into dev
ailiujiarui Nov 18, 2024
daa9e62
Update the code detail
ailiujiarui Nov 18, 2024
75ad0ee
Merge branch 'dev' into dev
SbloodyS Nov 18, 2024
c55261a
Merge branch 'dev' into dev
ailiujiarui Nov 18, 2024
66a7241
Merge branch 'dev' into dev
SbloodyS Nov 20, 2024
9fb23ae
Merge branch 'dev' into dev
ailiujiarui Nov 20, 2024
83d52e2
Merge branch 'apache:dev' into dev
ailiujiarui Nov 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions docs/docs/en/guide/task/java.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Overview

This node is for executing java-type tasks and supports using files and jar packages as program entries.
This node is used to execute tasks of the `Java` type and supports running `jar` packages of the `FAT_JAR` and `NORMAL_JAR` types.

# Create Tasks

Expand All @@ -20,24 +20,38 @@ This node is for executing java-type tasks and supports using files and jar pack
| Module Path | pick Java 9 + 's modularity feature, put all resources into-module-path, and require that the JDK version in your worker supports modularity. |
| Main Parameter | Java program main method entry parameter. |
| Java VM Parameters | JVM startup parameters. |
| Script | You need to write Java code if you use the Java run type. The public class must exist in the code without writing a package statement. |
| Main Package | Select the main program package to run the application. |
| Resources | External JAR packages or other resource files that are added to the classpath or module path and can be easily retrieved in your JAVA script. |

## Example

Java type tasks have two modes of execution, here is a demonstration of executing tasks in Java mode.
There are two execution modes for Java task types, which will be demonstrated separately here.

The main configuration parameters are as follows:
- Run Type
- Module Path
- Main Parameters
- Java VM Parameters
- Script
- Main Package
- Resources

![java_task](../../../../img/tasks/demo/java_task02.png)
As shown in the figure.

- FAT_JAR

![java_task](../../../../img/tasks/demo/java_fat.png)

`FAT_JAR` is also known as `uber-jar`, where the dependencies and code are contained within the same `jar`. You only need to select this one `jar`.

- NORMAL_JAR

![java_task](../../../../img/tasks/demo/java_normal.png)

`normal1.jar` is the entry point of the program, and `normal2.jar` contains the required dependencies. The entry point of the program must be specified in the main program package, and all the dependencies along with the program entry `jar` files should be selected in the resource file to ensure correct execution.

## Note

When you run the task in JAVA execution mode, the public class must exist in the code, and you could omit writing a package statement.
1. When using the `FAT_JAR` run type, you must select the main program package along with the corresponding resource file, otherwise, the task will fail immediately.
2. When using the `NORMAL_JAR` run type, you must select the main program package and the corresponding resource file, otherwise, the task will fail immediately. The main program package determines where the program starts, and after selecting the resource file, it will be called using the `-cp` option when running the program.
3. For security reasons, when executing JAVA tasks, please use the environment management module to configure the JDK environment, such as `JAVA_HOME` and other environment variables.

For security reasons, when executing JAVA tasks, please use the environment management module to configure the JDK environment, such as `JAVA_HOME` and other environment variables.
28 changes: 21 additions & 7 deletions docs/docs/zh/guide/task/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 综述

该节点用于执行 java 类型的任务,支持使用单文件和jar包作为程序入口
该节点用于执行`Java`类型的任务,支持使用`FAT_JAR`类型和`NORMAL_JAR`类型的`jar`包运行

## 创建任务

Expand All @@ -22,25 +22,39 @@
| 模块路径 | 开启使用JAVA9+的模块化特性,把所有资源放入--module-path中,要求您的worker中的JDK版本支持模块化 |
| 主程序参数 | 作为普通Java程序main方法入口参数 |
| 虚拟机参数 | 配置启动虚拟机参数 |
| 脚本 | 若使用JAVA运行类型则需要编写JAVA代码。代码中必须存在public类,不用写package语句 |
| 主程序包 | 选择要运行程序的主程序包 |
| 资源 | 可以是外部JAR包也可以是其他资源文件,它们都会被加入到类路径或模块路径中,您可以在自己的JAVA脚本中轻松获取 |

## 任务样例

java任务类型有两种运行模式,这里以JAVA模式为例进行演示
java任务类型有两种运行模式,这里进行分别进行演示

主要配置参数如下:

- 运行类型
- 模块路径
- 主程序参数
- 虚拟机参数
- 脚本文件
- 主程序包
- 资源文件

![java_task](../../../../img/tasks/demo/java_task02.png)
如图所示

- FAT_JAR类型

![java_task](../../../../img/tasks/demo/java_fat.png)

`FAT_JAR`即`uber-jar`,依赖和代码都在同一个`jar`中,只需选择这一个`jar`即可

- NORMAL_JAR类型

![java_task](../../../../img/tasks/demo/java_normal.png)

`normal1.jar`是程序运行的入口,`normal2.jar`是所需的依赖,需要用主程序包指定程序的入口,并且在资源文件中选择所有依赖和程序入口的`jar`文件,才能正确运行

## 注意事项

使用JAVA运行类型时代码中必须存在public类,可以不写package语句
1. 使用`FAT_JAR`运行类型必须选择主程序包,使用和对应的资源文件,否则任务会直接失败
2. 使用`NORMAL_JAR`运行类型必须选择主程序包和对应的资源文件,否则任务会直接失败。主程序包决定程序从哪里开始运行,选择资源文件之后,运行程序时,资源文件会以`-cp`的方式进行调用
3. 基于安全原因,执行JAVA任务时,请使用环境管理功能配置JDK环境,例如`JAVA_HOME`等环境变量

基于安全原因,执行JAVA任务时,请使用环境管理功能配置JDK环境,例如`JAVA_HOME`等环境变量
Binary file added docs/img/tasks/demo/java_fat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/tasks/demo/java_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/tasks/demo/java_task02.png
Binary file not shown.
Loading
Loading