-
Notifications
You must be signed in to change notification settings - Fork 50
feat(QTDI-693): manage nested jars #969
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
container/container-core/src/main/java/org/talend/sdk/component/container/ContainerManager.java
Show resolved
Hide resolved
...runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements support for managing nested JARs in the Talend SDK component runtime. The changes enable the system to detect and handle components that are packaged within fat JARs with embedded Maven repositories.
- Adds nested repository detection logic to check for
MAVEN-INF/repository
resources when default repository paths are used - Extends classloader functionality to track and expose nested JAR URLs
- Updates component scanning to handle nested repositories with proper filtering
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
ContainerManager.java | Implements nested repository detection and fallback logic for fat JAR scenarios |
Container.java | Adds public accessor method for nested repository status |
ConfigurableClassLoader.java | Tracks nested URLs and overrides getURLs() to include them |
ComponentManagerTest.java | Updates test expectations to account for nested JAR handling |
ComponentManager.java | Enhances component scanning to handle nested repositories with proper filtering |
Comments suppressed due to low confidence (1)
component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java:1328
- [nitpick] The log message format with manual bracket prefix is inconsistent with typical logging patterns. Consider using standard log formatting without manual prefixes.
log.info("[onCreate] Can't read nested scanning.properties: {}", e.getMessage());
if (PathFactory.get(System.getProperty("user.home")).resolve(".m2/repository").equals(rootRepo)) { | ||
final URL nested = classLoaderConfiguration.getParent().getResource("MAVEN-INF/repository"); | ||
if (nested != null) { | ||
rootRepo = Paths.get(nested.getFile().replace("file:", "")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using simple string replacement for URL handling is unreliable and may fail with encoded URLs or different URL formats. Consider using URI.create(nested.toString()).getPath() or proper URL decoding instead.
rootRepo = Paths.get(nested.getFile().replace("file:", "")); | |
rootRepo = Paths.get(URI.create(nested.toString()).getPath()); |
Copilot uses AI. Check for mistakes.
.orElseGet(() -> PathFactory.get(System.getProperty("user.home")).resolve(".m2/repository")); | ||
// if we've defaulted to user home m2 (fallback), we want to check if we're in running in a fatjar | ||
if (PathFactory.get(System.getProperty("user.home")).resolve(".m2/repository").equals(rootRepo)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed null fallback for System.getProperty("user.home") that was present in the original code. This could cause NullPointerException if the system property is not set.
.orElseGet(() -> PathFactory.get(System.getProperty("user.home")).resolve(".m2/repository")); | |
// if we've defaulted to user home m2 (fallback), we want to check if we're in running in a fatjar | |
if (PathFactory.get(System.getProperty("user.home")).resolve(".m2/repository").equals(rootRepo)) { | |
.orElseGet(() -> PathFactory.get(Optional.ofNullable(System.getProperty("user.home")).orElse("/tmp")).resolve(".m2/repository")); | |
// if we've defaulted to user home m2 (fallback), we want to check if we're in running in a fatjar | |
if (PathFactory.get(Optional.ofNullable(System.getProperty("user.home")).orElse("/tmp")).resolve(".m2/repository").equals(rootRepo)) { |
Copilot uses AI. Check for mistakes.
@@ -111,6 +111,8 @@ public class ConfigurableClassLoader extends URLClassLoader { | |||
@Getter | |||
private final List<String> cacheableClasses; | |||
|
|||
private List<URL> nestedURLs = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field should be declared as final since it's initialized once and never reassigned. Consider making it final for better immutability.
private List<URL> nestedURLs = new ArrayList<>(); | |
private final List<URL> nestedURLs = new ArrayList<>(); |
Copilot uses AI. Check for mistakes.
This comment has been minimized.
This comment has been minimized.
1 similar comment
Analysis Details0 IssuesCoverage and DuplicationsProject ID: org.talend.sdk.component:component-runtime |
https://qlik-dev.atlassian.net/browse/QTDI-693
component-runtime:
master:
maintenance/8.0.2 :