diff --git a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java index 18da9d7e62..891c1f0eaa 100644 --- a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java +++ b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java @@ -253,13 +253,16 @@ private void updateConnector() throws Exception { private Set getKameletDependencies(KameletModel kamelet) throws XPathExpressionException { Set deps = new HashSet<>(kamelet.getDependencies()); - Set gavDeps = deps.stream().map(stringDep -> { + Set gavDeps = deps.stream() + .filter(stringDep -> stringDep != null && !stringDep.trim().isEmpty() && !"null".equals(stringDep.trim())) + .map(stringDep -> { if (stringDep.startsWith("mvn:")) { return stringDep.replaceFirst("mvn:", ""); } else if (stringDep.startsWith("camel:")) { return getMainDepGroupId() + ":" + stringDep.replaceFirst(":", "-"); } else { - getLog().warn("Dependency " + stringDep + "is used as is. Might not be the intended behaviour!"); + String length = stringDep == null ? "the string is null value" : Integer.toString(stringDep.length()); + getLog().warn("Dependency string: " + stringDep + " (length of the string is: " + length + ") is used as is. Might not be the intended behaviour!"); return stringDep; } }).collect(Collectors.toSet()); diff --git a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/utils/YamlKameletMapper.java b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/utils/YamlKameletMapper.java index 6cae0513a0..5f21226270 100644 --- a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/utils/YamlKameletMapper.java +++ b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/utils/YamlKameletMapper.java @@ -65,7 +65,11 @@ public static KameletModel parseKameletYaml(ObjectNode kameletYamlNode) { km.setRequiredProperties(requiredProperties); Set dependencies = new HashSet<>(); - kameletYamlNode.at("/spec/dependencies").forEach(req -> dependencies.add(req.asText())); + kameletYamlNode.at("/spec/dependencies").forEach(req -> { + if (req != null && !req.isNull()) { + dependencies.add(req.asText()); + } + }); km.setDependencies(dependencies); List kpms = new ArrayList<>();