You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by fm...@apache.org on 2023/03/16 16:27:52 UTC
[camel] branch camel-3.x updated: Download only existing artifacts
This is an automated email from the ASF dual-hosted git repository.
fmariani pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.x by this push:
new be578084bb8 Download only existing artifacts
be578084bb8 is described below
commit be578084bb80a80911c3721d8ad7f196075ee870
Author: Croway <fe...@gmail.com>
AuthorDate: Thu Mar 16 16:39:56 2023 +0100
Download only existing artifacts
---
.../main/download/MavenDependencyDownloader.java | 35 ++++++++++++----------
1 file changed, 20 insertions(+), 15 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 60c999b809c..0b2be581ba6 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
@@ -470,24 +470,29 @@ public class MavenDependencyDownloader extends ServiceSupport implements Depende
throws Exception {
String gav = "org.apache.camel.quarkus" + ":" + "camel-quarkus" + ":pom:" + quarkusVersion;
- List<MavenArtifact> artifacts = resolveDependenciesViaAether(List.of(gav), extraRepos, false, false);
- if (!artifacts.isEmpty()) {
- MavenArtifact ma = artifacts.get(0);
- if (ma != null && ma.getFile() != null) {
- String name = ma.getFile().getAbsolutePath();
- File file = new File(name);
- if (file.exists()) {
- DocumentBuilderFactory dbf = XmlHelper.createDocumentBuilderFactory();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document dom = db.parse(file);
- // the camel version is in <parent>
- NodeList nl = dom.getElementsByTagName("parent");
- if (nl.getLength() == 1) {
- Element node = (Element) nl.item(0);
- return node.getElementsByTagName("version").item(0).getTextContent();
+ try {
+ List<MavenArtifact> artifacts = resolveDependenciesViaAether(List.of(gav), extraRepos, false, false);
+ if (!artifacts.isEmpty()) {
+ MavenArtifact ma = artifacts.get(0);
+ if (ma != null && ma.getFile() != null) {
+ String name = ma.getFile().getAbsolutePath();
+ File file = new File(name);
+ if (file.exists()) {
+ DocumentBuilderFactory dbf = XmlHelper.createDocumentBuilderFactory();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document dom = db.parse(file);
+ // the camel version is in <parent>
+ NodeList nl = dom.getElementsByTagName("parent");
+ if (nl.getLength() == 1) {
+ Element node = (Element) nl.item(0);
+ return node.getElementsByTagName("version").item(0).getTextContent();
+ }
}
}
}
+ } catch (DownloadException ex) {
+ // Artifact may not exist on repository, just skip it
+ LOG.debug(ex.getMessage(), ex);
}
return null;