[DS-6091][standalone] Fix DolphinPluginDiscovery load plugin fails on Windows os#6207
[DS-6091][standalone] Fix DolphinPluginDiscovery load plugin fails on Windows os#6207LiuBodong wants to merge 6 commits intoapache:devfrom LiuBodong:6091-bugfix-standalone-not-works-on-windows
Conversation
Fix the bug that StandaloneServer run failed on Windows system.
(1) StandaloneServer fails on Windows
The bug's reason is when we call `Class#getProtectionDomain().getCodeSource().getLocation().getPath()` on Windows, JAVA will return a path starts with '/', and then we use `Paths.get(path)` to transform the path, the bug appears.
The solution is use `Paths.get(URL url)` method to transform the path, it will work correctly.
(2) DolphinPluginDiscovery fails on Windows
The bug's reason is use `File#getPath.endsWith("/target/classes")` to judge if the given path is compiled class path. On Windows, the delimiter of path is '\', so the method always returns false.
The solution is use `Paths.endsWith(Path other)` method to judge, it will work correctly.
| StandaloneServer.class.getProtectionDomain().getCodeSource().getLocation().getPath(), | ||
| "../../../dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml" | ||
| ).toAbsolutePath(); | ||
|
|
| StandaloneServer.class.getProtectionDomain().getCodeSource().getLocation().getPath(), | ||
| "../../../dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml" | ||
| ).toAbsolutePath(); | ||
|
|
|
This PR is duplicate with #6101, can you please coordinate with @QuakeWang which PR we should continue? |
I already send an e-mail to @QuakeWang , we will talk later |
|
We have discussed and come up with the following recommendation: This pr retains the changes to DolphinPluginDiscovery. The changes to StandaloneServer are still based on #6101. |
… 6091-bugfix-standalone-not-works-on-windows
…tion and only retain modification of DolphinPluginDiscovery.java
|
I just revert the modification of StandaloneServer.java, now the pr only contains modification of DolphinPluginDiscovery.java. Please do a code review~ |
|
@LiuBodong please update the PR title and commit message accordingly |
…/github.com/LiuBodong/dolphinscheduler into 6091-bugfix-standalone-not-works-on-windows
Codecov Report
@@ Coverage Diff @@
## dev #6207 +/- ##
============================================
- Coverage 39.07% 39.06% -0.01%
+ Complexity 3250 3249 -1
============================================
Files 638 638
Lines 25266 25267 +1
Branches 2743 2743
============================================
- Hits 9872 9871 -1
- Misses 14516 14517 +1
- Partials 878 879 +1
Continue to review full report at Codecov.
|
|
Kudos, SonarCloud Quality Gate passed! |
|
already fixed in another pr |








Purpose of the pull request
Fix the bug that StandaloneServer run failed on Windows system.
Brief change log
The bug's reason is use
File#getPath.endsWith("/target/classes")to judge if the given path is compiled class path. On Windows, the delimiter of path is '', so the method always returns false.The solution is use
Paths.endsWith(Path other)method to judge, it will work correctly.resolves #6091