You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/10/20 09:14:27 UTC

[camel] 01/02: CAMEL-18624: camel-jbang - Should load custom type converters when adding new JARs

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 3139a76ca6f6f38d0a6282da9580b1ac8113b799
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Oct 20 11:00:27 2022 +0200

    CAMEL-18624: camel-jbang - Should load custom type converters when adding new JARs
---
 .../camel/main/download/MavenDependencyDownloader.java      | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java
index 53b48ffba5a..790aae25cb1 100644
--- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java
+++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/MavenDependencyDownloader.java
@@ -363,6 +363,7 @@ public class MavenDependencyDownloader extends ServiceSupport implements Depende
             }
 
             List<MavenArtifact> artifacts = resolveDependenciesViaAether(deps, repositories, transitively);
+            List<File> files = new ArrayList<>();
             LOG.debug("Resolved {} -> [{}]", gav, artifacts);
 
             for (MavenArtifact a : artifacts) {
@@ -374,16 +375,18 @@ public class MavenDependencyDownloader extends ServiceSupport implements Depende
                         DependencyDownloaderClassLoader ddc = (DependencyDownloaderClassLoader) classLoader;
                         ddc.addFile(file);
                     }
-                    // trigger listener after downloaded and added to classloader
-                    for (ArtifactDownloadListener listener : artifactDownloadListeners) {
-                        listener.onDownloadedFile(file);
-                    }
+                    files.add(file);
                     LOG.trace("Added classpath: {}", a.getGav());
                 }
             }
 
+            // trigger listeners after downloaded and added to classloader
+            for (File file : files) {
+                for (ArtifactDownloadListener listener : artifactDownloadListeners) {
+                    listener.onDownloadedFile(file);
+                }
+            }
             if (!artifacts.isEmpty()) {
-                // trigger listener after downloaded and added to classloader
                 for (DownloadListener listener : downloadListeners) {
                     listener.onDownloadedDependency(groupId, artifactId, version);
                 }