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

davsclaus pushed a commit to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.18.x by this push:
     new 3595a21c3d2 CAMEL-18624: camel-jbang - Should load custom type 
converters when adding new JARs
3595a21c3d2 is described below

commit 3595a21c3d2460ea529540ded774525582e2b699
Author: Claus Ibsen <[email protected]>
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 bb95484a3be..b46c3aa2c43 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
@@ -157,6 +157,7 @@ public class MavenDependencyDownloader extends 
ServiceSupport implements Depende
                 mavenRepos.add(APACHE_SNAPSHOT_REPO);
             }
 
+            List<File> files = new ArrayList<>();
             List<MavenArtifact> artifacts
                     = 
MavenDependencyResolver.resolveDependenciesViaAether(deps, mavenRepos, false, 
fresh, transitively);
             LOG.debug("Resolved {} -> [{}]", gav, artifacts);
@@ -170,16 +171,18 @@ public class MavenDependencyDownloader extends 
ServiceSupport implements Depende
                 if (!alreadyOnClasspath(a.getGav().getGroupId(), 
a.getGav().getArtifactId(),
                         a.getGav().getVersion(), false)) {
                     classLoader.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);
                 }

Reply via email to