Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.talend.sdk.component.runtime.manager;

import static java.lang.String.format;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
Expand Down Expand Up @@ -213,11 +214,14 @@ private static ComponentManager buildNewComponentManager() {
{
info("ComponentManager version: " + ComponentManagerVersion.VERSION);
info("Creating the contextual ComponentManager instance " + getIdentifiers());

parallelIf(Boolean.getBoolean("talend.component.manager.plugins.parallel"),
container.getDefinedNestedPlugin().stream().filter(p -> !hasPlugin(p)))
.forEach(this::addPlugin);
info("Components: " + availablePlugins());
try {
parallelIf(Boolean.getBoolean("talend.component.manager.plugins.parallel"),
container.getDefinedNestedPlugin().stream().filter(p -> !hasPlugin(p)))
.forEach(this::addPlugin);
info("Components: " + availablePlugins());
} catch (Exception e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems here only catch the exception and ignore it, is enough?

info(format("Error while loading plugin found in plugins.properties: %s.", e.getMessage()));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public ContainerManager(final DependenciesResolutionConfiguration dependenciesRe
this.logInfoLevelMapping = logInfoLevelMapping;
this.containerInitializer = containerInitializer;
this.resolver = dependenciesResolutionConfiguration.getResolver();
final boolean hasClasspathJar = "classpath.jar".equals(System.getProperty("java.class.path", ""));
Copy link
Contributor

@wwang-talend wwang-talend Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"classpath.jar" is valid for remote job server run way and other cases? in my memory, is only for local run in studio which as test mode for customer. Maybe i am wrong.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://qlik-dev.atlassian.net/browse/SUPPORT-6134
so we can't suppose classpath.jar for jobserver/remote engine case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong but it seems that the classpath.jar is alway created by the JobServer when it receives a job execution to avoid artifacts duplications.

local run of a studio job exported to zip, uses a batch script to launch job's execution. This script sets the m2 system property used by component manager to the lib folder provided by export.

java -Dtalend.component.manager.m2.repository=$ROOT_PATH/../lib ...

Thus not the specific case related.

In fact, this fix apply only when a classpath.jar is provided to jvm, not the other cases when the m2 property is correctly set.

The SUPPORT-6134 issue mentions "Cloud Export" and specifies in the description Talend > Import/Export > Add classpath jar in exported jobs (not compatible with JobServer).
Apparently, Cloud export works the same as local exported jobs...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added case when CLASSPATH_SIZE_THRESHOLD (in JobServer properties) value is set to a very high value. Thus, no classpath.jar is generated.

Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded string classpath.jar should be extracted as a constant to improve maintainability and make the detection logic more explicit.

Copilot uses AI. Check for mistakes.


Path rootRepo = ofNullable(dependenciesResolutionConfiguration.getRootRepositoryLocation())
.filter(Files::exists)
Expand All @@ -119,7 +120,8 @@ public ContainerManager(final DependenciesResolutionConfiguration dependenciesRe
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 = PathFactory.get(nested.getFile().replace("file:", ""));
info("Nested maven repository: " + nested.getFile());
rootRepo = PathFactory.get(nested.getFile().replaceAll("^(file|nested):", ""));
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern ^(file|nested): uses a hardcoded string that may not cover all URL scheme variations. Consider using URL.toURI().getPath() or a more robust URL parsing approach to handle different schemes consistently.

Suggested change
rootRepo = PathFactory.get(nested.getFile().replaceAll("^(file|nested):", ""));
try {
rootRepo = PathFactory.get(nested.toURI().getPath());
} catch (Exception e) {
throw new IllegalStateException("Failed to extract path from nested repository URL: " + nested, e);
}

Copilot uses AI. Check for mistakes.

}
}
this.rootRepositoryLocation = rootRepo;
Expand All @@ -136,7 +138,10 @@ public ContainerManager(final DependenciesResolutionConfiguration dependenciesRe
if (classLoaderConfiguration.isSupportsResourceDependencies()) {
try (final InputStream mappingStream =
classLoaderConfiguration.getParent().getResourceAsStream(nestedPluginMappingResource)) {
if (mappingStream != null) {
// When a `classpath.jar` is provided to jvm (like JobServer) using plugin path based on maven
// repository structure is not functional. Therefore, we skip loading the nested plugin mapping when
// hasClasspathJar is true. Autodiscovery will find plugins later.
if (mappingStream != null && !hasClasspathJar) {
final Properties properties = new Properties() {

{
Expand Down
Loading