From 107ae34e4a03bcef6189837f9ef35968108146f2 Mon Sep 17 00:00:00 2001 From: Gelila Sahle Date: Thu, 19 Sep 2024 13:40:12 -0400 Subject: [PATCH 1/3] include version for unmanaged deps --- .../dependency/analyze/AbstractAnalyzeMojo.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java index 76210d222..27b43d01b 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java +++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java @@ -559,6 +559,17 @@ private void writeDependencyXML(Set artifacts) { writer.startElement("artifactId"); writer.writeText(artifact.getArtifactId()); writer.endElement(); + String dependencyKey = String.format( + "%s:%s:%s:%s", + artifact.getGroupId(), + artifact.getArtifactId(), + artifact.getType(), + (artifact.getClassifier() != null ? ":" : artifact.getClassifier())); + if (!managedDependencies.contains(dependencyKey)) { + writer.startElement("version"); + writer.writeText(artifact.getBaseVersion()); + writer.endElement(); + } if (!managedDependencies.contains(artifact.getDependencyConflictId())) { writer.startElement("version"); writer.writeText(artifact.getBaseVersion()); From 92de5aa1673b45a085d4b42d4a60d4f5ad1dbbba Mon Sep 17 00:00:00 2001 From: Gelila Sahle Date: Thu, 19 Sep 2024 14:03:51 -0400 Subject: [PATCH 2/3] change variable name --- .../maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java index 27b43d01b..8ada44197 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java +++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java @@ -559,13 +559,13 @@ private void writeDependencyXML(Set artifacts) { writer.startElement("artifactId"); writer.writeText(artifact.getArtifactId()); writer.endElement(); - String dependencyKey = String.format( + String key = String.format( "%s:%s:%s:%s", artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(), (artifact.getClassifier() != null ? ":" : artifact.getClassifier())); - if (!managedDependencies.contains(dependencyKey)) { + if (!managedDependencies.contains(key)) { writer.startElement("version"); writer.writeText(artifact.getBaseVersion()); writer.endElement(); From 3c63c0ec82fc32b394f35973992d02deb57a07a2 Mon Sep 17 00:00:00 2001 From: Gelila Sahle Date: Fri, 20 Sep 2024 12:59:00 -0400 Subject: [PATCH 3/3] fix the conditional --- .../maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java index 8ada44197..054639a1c 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java +++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java @@ -560,11 +560,11 @@ private void writeDependencyXML(Set artifacts) { writer.writeText(artifact.getArtifactId()); writer.endElement(); String key = String.format( - "%s:%s:%s:%s", + "%s:%s:%s%s", artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(), - (artifact.getClassifier() != null ? ":" : artifact.getClassifier())); + (artifact.getClassifier() != null ? ":" + artifact.getClassifier() : "")); if (!managedDependencies.contains(key)) { writer.startElement("version"); writer.writeText(artifact.getBaseVersion());