Croway commented on PR #26299: URL: https://github.com/apache/camel/pull/26299#issuecomment-5631976028
This backport has the same diff as #26293, and `ExportSpringBoot` is identical on `camel-4.22.x` and `main`, so the two issues I reported on #26293 apply here too: 1. **Duplicate repository ids (regression).** With `--repos=atlassian=https://packages.atlassian.com/maven-external/,https://repository.apache.org/snapshots/`, the exported POM lists `<id>atlassian</id>` twice, and Maven rejects it: `'repositories.repository.id' must be unique`. `getMavenRepositories` adds `camel.jbang.repos` from the export settings as one comma-joined element, but adds `--repos` split into entries, so nothing gets de-duplicated. 2. **Catalog-provided `spring-boot-pom.tmpl`.** `legacyMavenRepositoriesAsPomXml` still writes `id=url` entries verbatim (`<url>atlassian=https://…</url>`). Minimal fix, the same one I suggested on #26293 (details and verification there): ```diff --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java if (propRepositories != null) { - answer.add(propRepositories); + Collections.addAll(answer, propRepositories.split("\\s*,\\s*")); } @@ if (mavenResolver.repos() != null) { - Collections.addAll(answer, this.mavenResolver.repos().split(",")); + Collections.addAll(answer, this.mavenResolver.repos().split("\\s*,\\s*")); } ``` ```diff --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportSpringBoot.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportSpringBoot.java private static String legacyMavenRepositoriesAsPomXml(String repos) { + List<Map<String, Object>> list = buildRepositoryList(repos); StringBuilder sb = new StringBuilder(); - int i = 1; sb.append(" <repositories>\n"); - for (String repo : repos.split(",")) { + for (Map<String, Object> repo : list) { sb.append(" <repository>\n"); - sb.append(" <id>custom").append(i++).append("</id>\n"); - sb.append(" <url>").append(repo).append("</url>\n"); - if (repo.contains("snapshots")) { + sb.append(" <id>").append(repo.get("id")).append("</id>\n"); + sb.append(" <url>").append(repo.get("url")).append("</url>\n"); + if (Boolean.TRUE.equals(repo.get("isSnapshot"))) { @@ sb.append(" <pluginRepositories>\n"); - for (String repo : repos.split(",")) { + for (Map<String, Object> repo : list) { sb.append(" <pluginRepository>\n"); - sb.append(" <id>custom").append(i++).append("</id>\n"); - sb.append(" <url>").append(repo).append("</url>\n"); - if (repo.contains("snapshots")) { + sb.append(" <id>plugin-").append(repo.get("id")).append("</id>\n"); + sb.append(" <url>").append(repo.get("url")).append("</url>\n"); + if (Boolean.TRUE.equals(repo.get("isSnapshot"))) { ``` If the fix lands on #26293 first and is then cherry-picked here, this PR stays a straight backport. _Claude Code on behalf of Croway_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
