Skip to content

Commit c3f75e3

Browse files
committedFeb 27, 2025
fix(Maven): Do not duplicate hints about auto-generated POMs
For multi-module Maven projects, the hint about an auto-generated POM was generated for each project. This is because the dependency graph builder is shared by all projects, and packages are aggregated. To prevent this, inspect only newly added packages. The hint is then added only once for the project that referenced the package for the first time. Signed-off-by: Oliver Heger <oliver.heger@bosch.io>
1 parent 1be81f2 commit c3f75e3

File tree

1 file changed

+2
-1
lines changed
  • plugins/package-managers/maven/src/main/kotlin

1 file changed

+2
-1
lines changed
 

‎plugins/package-managers/maven/src/main/kotlin/Maven.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class Maven(
107107
val projectBuildingResult = mavenSupport.buildMavenProject(definitionFile)
108108
val mavenProject = projectBuildingResult.project
109109
val projectId = mavenProject.identifier(projectType)
110+
val knownPackages = graphBuilder.packages()
110111

111112
// If running in SBT mode expect that POM files were generated in a "target" subdirectory and that the correct
112113
// project directory is the parent directory of this.
@@ -129,7 +130,7 @@ class Maven(
129130
graphBuilder.scopesFor(projectId)
130131
)
131132

132-
val issues = graphBuilder.packages().mapNotNull { pkg ->
133+
val issues = (graphBuilder.packages() - knownPackages).mapNotNull { pkg ->
133134
if (pkg.description == "POM was created by Sonatype Nexus") {
134135
createAndLogIssue(
135136
managerName,

0 commit comments

Comments
 (0)
Please sign in to comment.