You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "gansheer (via GitHub)" <gi...@apache.org> on 2026/09/11 07:34:12 UTC
[PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
gansheer opened a new pull request, #26293:
URL: https://github.com/apache/camel/pull/26293
# Description
Add camel.jbang.repos and camel.extra.repos to generated project POM.
Needs to be backported to 4.22
_AI-assisted with Claude Code on behalf of @gansheer_
# Target
- [X] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch)
# Tracking
- [X] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
<!--
# *Note*: trivial changes like, typos, minor documentation fixes and other small items do not require a JIRA issue. In this case your pull request should address just this issue, without pulling in other changes.
-->
# Apache Camel coding standards and style
- [X] I checked that each commit in the pull request has a meaningful subject line and body.
<!--
If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
-->
- [X] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes.
<!--
You can run the aforementioned command in your module so that the build auto-formats your code. This will also be verified as part of the checks and your PR may be rejected if if there are uncommited changes after running `mvn clean install -DskipTests`.
You can learn more about the contribution guidelines at https://github.com/apache/camel/blob/main/CONTRIBUTING.md
-->
# AI-assisted contributions
- [X] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5632521460
> > can the JVM Keys be renamed to something understandable and they should at least start with the same leading name
>
> I can add this to the deferred to follow-up. I plan to create a jira issue for it.
No please make better name first, otherwise its harder to rename later
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5632909842
okay the keys with the bad name has been released in 4.18.x LTS so we are stuck with that.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5632508188
> can the JVM Keys be renamed to something understandable and they should at least start with the same leading name
I can add this to the deferred to follow-up. I plan to create a jira issue for it.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5633849822
Same result as for the backport. Merging as well
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #26293:
URL: https://github.com/apache/camel/pull/26293#discussion_r3987498437
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -1289,6 +1304,17 @@ protected String getMavenRepositories(Path settings, Properties prop, String cam
Collections.addAll(answer, this.mavenResolver.repos().split(","));
}
Review Comment:
⚠️ **Short-name resolution gap** — `MavenDownloaderImpl.configureRepositories()` delegates to `RepositoryResolver` which maps short names like `redhat`, `central`, `apache-snapshot` to full URLs via `known-maven-repos.properties`. Here, `extraRepos` values are added raw — so `-Dcamel.extra.repos=redhat` would pass `redhat` to `buildRepositoryList()` which would emit `<url>redhat</url>` in the generated POM.
This was raised in the previous review and in Croway's comment. If the shared-helper refactoring is planned for a follow-up, consider adding a code comment or a TODO so it doesn't get lost.
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -421,9 +424,17 @@ protected static List<Map<String, Object>> buildRepositoryList(String repos) {
int i = 1;
for (String repo : repos.split(",")) {
Map<String, Object> r = new HashMap<>();
- r.put("id", "custom" + i++);
- r.put("url", repo);
- r.put("isSnapshot", repo.contains("snapshots"));
+ // support id=url format (used by camel.extra.repos)
+ int eq = repo.indexOf('=');
+ if (eq > 0 && eq < repo.length() - 1 && !repo.startsWith("http")) {
+ r.put("id", repo.substring(0, eq));
Review Comment:
👍 This now aligns with `MavenDownloaderImpl.configureRepositories()` which uses `!repo.startsWith("http")`. The added `eq < repo.length() - 1` guard also prevents `IndexOutOfBoundsException` on trailing `=`.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #26293:
URL: https://github.com/apache/camel/pull/26293#discussion_r3987124630
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -421,9 +421,17 @@ protected static List<Map<String, Object>> buildRepositoryList(String repos) {
int i = 1;
for (String repo : repos.split(",")) {
Map<String, Object> r = new HashMap<>();
- r.put("id", "custom" + i++);
- r.put("url", repo);
- r.put("isSnapshot", repo.contains("snapshots"));
+ // support id=url format (used by camel.extra.repos)
+ int eq = repo.indexOf('=');
+ if (eq > 0 && repo.indexOf('/') > eq) {
+ r.put("id", repo.substring(0, eq));
+ r.put("url", repo.substring(eq + 1));
Review Comment:
⚠️ This `id=url` detection heuristic (`indexOf('/') > eq`) diverges from `MavenDownloaderImpl.configureRepositories()` which uses `!repo.startsWith("http")`. Both work for the standard case, but a shared helper would eliminate the divergence and centralize the parsing logic. See Croway's comment for the full list of behavioral differences.
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -1289,6 +1301,16 @@ protected String getMavenRepositories(Path settings, Properties prop, String cam
Collections.addAll(answer, this.mavenResolver.repos().split(","));
}
+ // include extra repos from system property
+ String extraRepos = System.getProperty("camel.extra.repos");
Review Comment:
💡 This property name is hardcoded as `"camel.extra.repos"` while `MavenDownloaderImpl` uses a constant `EXTRA_DEFAULT_REPOS_PROPERTY`. Also missing: the `camel.default.extra.repos.default.value` fallback that `loadExtraDefaultRepositories()` checks. A shared utility method would avoid both issues.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5632487187
can the JVM Keys be renamed to something understandable and they should at least start with the same leading name
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5633317881
Currently running manually the IT tests, will merge at successfull completion :crossed_fingers:
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5631340618
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `dsl/camel-jbang/camel-jbang-core`
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 7 tested, 8 compile-only — current: 6 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **15 affected modules** (current approach: 6).
<details><summary>:warning: Modules only in Scalpel (9)</summary>
- `camel-jbang-core`
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `camel-launcher`
- `coverage`
</details>
**Skip-tests mode would test 7 modules** (1 direct + 6 downstream), **skip tests for 8** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (7)</summary>
- `camel-jbang-core`
- `camel-jbang-mcp`
- `camel-jbang-plugin-mcp`
- `camel-jbang-plugin-route-parser`
- `camel-jbang-plugin-tui`
- `camel-jbang-plugin-validate`
- `camel-launcher-container`
</details>
<details><summary>Modules with tests skipped (8)</summary>
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `camel-launcher`
- `coverage`
</details>
> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
:warning: **Some tests are disabled on GitHub Actions** (`@DisabledIfSystemProperty(named = "ci.env.name")`) and require manual verification:
- `dsl/camel-jbang/camel-jbang-core`: 1 test(s) disabled on GitHub Actions
:bulb: **Manual integration tests recommended:**
> You modified `dsl/camel-jbang/camel-jbang-core`. The related integration tests in `dsl/camel-jbang/camel-jbang-it` are excluded from CI. Consider running them manually:
> ```
> mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
> ```
<details><summary>All tested modules (15 modules, 3m 4s total)</summary>
**Total reactor time:** 3m 4s
| Module | Duration | Status |
| --- | --- | --- |
| Camel :: Launcher | 54.4s | SUCCESS |
| Camel :: JBang :: MCP | 44.9s | SUCCESS |
| Camel :: JBang :: Plugin :: TUI | 40.9s | SUCCESS |
| Camel :: JBang :: Plugin :: Kubernetes | 19.2s | SUCCESS |
| Camel :: JBang :: Plugin :: Testing | 10.0s | SUCCESS |
| Camel :: Coverage | 5.5s | SUCCESS |
| Camel :: JBang :: Plugin :: Validate | 1.5s | SUCCESS |
| Camel :: JBang :: Plugin :: Edit | 1.5s | SUCCESS |
| Camel :: JBang :: Plugin :: Generate | 1.4s | SUCCESS |
| Camel :: JBang :: Integration tests | 1.1s | SUCCESS |
| Camel :: JBang :: Plugin :: Route Parser | 0.9s | SUCCESS |
| Camel :: JBang :: Main | 0.9s | SUCCESS |
| Camel :: Launcher :: Container | 0.9s | SUCCESS |
| Camel :: JBang :: Plugin :: MCP | 0.9s | SUCCESS |
| Camel :: JBang :: Core | n/a | |
**Top 20 slowest modules:**
- `Camel :: Launcher` (54.4s)
- `Camel :: JBang :: MCP` (44.9s)
- `Camel :: JBang :: Plugin :: TUI` (40.9s)
- `Camel :: JBang :: Plugin :: Kubernetes` (19.2s)
- `Camel :: JBang :: Plugin :: Testing` (10.0s)
- `Camel :: Coverage` (5.5s)
- `Camel :: JBang :: Plugin :: Validate` (1.5s)
- `Camel :: JBang :: Plugin :: Edit` (1.5s)
- `Camel :: JBang :: Plugin :: Generate` (1.4s)
- `Camel :: JBang :: Integration tests` (1.1s)
- `Camel :: JBang :: Plugin :: Route Parser` (0.9s)
- `Camel :: JBang :: Main` (0.9s)
- `Camel :: Launcher :: Container` (0.9s)
- `Camel :: JBang :: Plugin :: MCP` (0.9s)
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/34574997804)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #26293:
URL: https://github.com/apache/camel/pull/26293#discussion_r3987507837
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -421,9 +424,17 @@ protected static List<Map<String, Object>> buildRepositoryList(String repos) {
int i = 1;
for (String repo : repos.split(",")) {
Map<String, Object> r = new HashMap<>();
- r.put("id", "custom" + i++);
- r.put("url", repo);
- r.put("isSnapshot", repo.contains("snapshots"));
+ // support id=url format (used by camel.extra.repos)
+ int eq = repo.indexOf('=');
+ if (eq > 0 && eq < repo.length() - 1 && !repo.startsWith("http")) {
Review Comment:
The `id=url` detection now matches `MavenDownloaderImpl.configureRepositories()` — good. However, `MavenDownloaderImpl` calls `repositoryResolver.resolveRepository(repo)` **before** parsing `id=url`, which resolves short names like `redhat` → `redhat=https://maven.repository.redhat.com/...` via `known-maven-repos.properties`. This method doesn't resolve short names, so `-Dcamel.extra.repos=redhat` would emit `<url>redhat</url>` in the generated POM — a broken URL.
This is the same gap flagged in the previous review (Croway's point #2). It could be addressed here by extracting the `id=url` parsing + `RepositoryResolver` call into a shared helper in `camel-tooling-maven`, or at minimum documenting that export only supports full URLs (not short names) as a known limitation.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #26293:
URL: https://github.com/apache/camel/pull/26293#discussion_r3987541899
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -1267,6 +1278,10 @@ protected String getMavenRepositories(Path settings, Properties prop, String cam
Set<String> answer = new LinkedHashSet<>();
String propRepositories = prop.getProperty(REPOS);
+ if (propRepositories == null) {
+ // fallback to system property
+ propRepositories = System.getProperty(REPOS);
+ }
if (propRepositories != null) {
answer.add(propRepositories);
Review Comment:
🔴 **Regression: duplicate repository IDs** — This adds the entire comma-joined `propRepositories` as a single `LinkedHashSet` element. When the same repos are also added individually via `mavenResolver.repos().split(",")` at line 1304, the set can't deduplicate. `buildRepositoryList()` then splits the final joined string by comma, producing duplicate entries with the same `id` — Maven rejects the POM.
As Croway's reproducer shows: `--repos=atlassian=https://packages.atlassian.com/maven-external/,https://repository.apache.org/snapshots/` triggers this because `camel.jbang.repos` gets the full `--repos` value.
```suggestion
Collections.addAll(answer, propRepositories.split("\\s*,\\s*"));
```
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -1289,6 +1304,17 @@ protected String getMavenRepositories(Path settings, Properties prop, String cam
Collections.addAll(answer, this.mavenResolver.repos().split(","));
Review Comment:
💡 Minor inconsistency: this splits on plain `,` while the `extraRepos` split at line 1311 uses `\\s*,\\s*` (trimming whitespace). Aligning them would make the behavior uniform:
```suggestion
Collections.addAll(answer, this.mavenResolver.repos().split("\\s*,\\s*"));
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5631067991
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5631943158
1. Aligned id=url heuristic with MavenDownloaderImpl — buildRepositoryList() now uses !repo.startsWith("http") instead of repo.indexOf('/') > eq to detect the id=url format, matching MavenDownloaderImpl.configureRepositories().
2. Added camel.default.extra.repos.default.value fallback — getMavenRepositories() now falls back to this property when camel.extra.repos is not set, matching MavenDownloaderImpl.loadExtraDefaultRepositories().
3. Fixed legacyMavenRepositoriesAsPomXml — the legacy Spring Boot template path now reuses buildRepositoryList() to correctly parse id=url format. Previously, camel.extra.repos=atlassian=https://… would produce
<url>atlassian=https://…</url>. Also adds plugin- prefix on <pluginRepository> ids to avoid duplicate id warnings, consistent with the FreeMarker templates.
4. Extracted constants — EXTRA_REPOS_PROPERTY and EXTRA_REPOS_DEFAULT_VALUE_PROPERTY replace hardcoded strings, consistent with the pattern in MavenDownloaderImpl.
5. Added test — shouldExportWithExtraReposDefaultValueFallback verifies the fallback property path.
Not addressed (follow-up): short-name resolution via RepositoryResolver (e.g. -Dcamel.extra.repos=redhat resolving to a URL). This requires a shared helper in camel-tooling-maven, tracked as a separate improvement.
@gnodet-bot after discussing with @Croway we agree that while the refactoring should be done it should be better to avoid backporting it to 4.22.
Is it good for you ?
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5631975771
Follow-up after running a reproducer locally against this branch and `main`.
### 1. Regression: duplicate repository ids make the exported `pom.xml` invalid
If `--repos` has more than one entry and at least one uses `id=url`, the exported POM lists that id twice. Example:
```
camel export --runtime=spring-boot --repos=atlassian=https://packages.atlassian.com/maven-external/,https://repository.apache.org/snapshots/
```
Maven then refuses to load the project:
```
'repositories.repository.id' must be unique: atlassian -> https://packages.atlassian.com/maven-external/ vs https://packages.atlassian.com/maven-external/
```
I reproduced this with `--runtime=spring-boot` and `--runtime=main`. `ExportQuarkus` uses the same `getMavenRepositories` / `buildRepositoryList` code, but I didn't run it. On `main`, the same command gives a valid POM, and only the `id=url` entry has a bad URL.
Cause: export settings contain `camel.jbang.repos=<value of --repos>`.
- `getMavenRepositories` adds that value as a single comma-joined element.
- It adds `mavenResolver.repos()` split into separate entries.
- The `LinkedHashSet` therefore can't de-duplicate, and every entry appears twice.
This was harmless while every entry got a unique `customN` id. Now that `id=url` keeps its id, it breaks the POM. The new tests only use `camel.extra.repos`, which doesn't go through this path.
### 2. Correction to my previous comment: catalog-provided template
No upstream camel-catalog or camel-spring-boot release ships `spring-boot-pom.tmpl`. The legacy path only runs for catalogs that provide their own template (the CAMEL-19120 hook), and it isn't a regression. It does still write `id=url` entries verbatim, so Maven can't use them:
```
Cannot access atlassian=https://packages.atlassian.com/maven-external/ with type default using the available connector factories
```
### Results
To exercise the legacy path, I put the pre-CAMEL-21208 template on the test classpath. The last column uses the fix below.
| Input | Template | `main` | this PR | PR + fix below |
|---|---|---|---|---|
| `camel.extra.repos=atlassian=…` | FreeMarker | repo missing | ✅ | ✅ |
| `camel.extra.repos=atlassian=…` | catalog `.tmpl` | repo missing | ❌ `<url>atlassian=…</url>` | ✅ |
| `--repos=atlassian=…,https://…/snapshots/` | FreeMarker | ❌ `<url>atlassian=…</url>` | ❌ duplicate ids, POM invalid | ✅ |
| `--repos` with an `id=url` entry | catalog `.tmpl` | ❌ `<url>atlassian=…</url>` | ❌ `<url>atlassian=…</url>` | ✅ |
### Suggested minimal fix
Verification:
- Every exported POM passes `mvn validate`.
- An Atlassian-only artifact (`com.atlassian.jira:jira-api:9.12.0`) resolves from the fixed POM.
- The new `ExportTest` tests still pass.
```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"))) {
```
The legacy path now uses the same ids as `spring-boot-pom.ftl` (`<id>` / `<id>plugin-…</id>`). A test that exports with `--repos=<id>=<url>,<another url>` and asserts unique repository ids would cover the regression.
### Longer term
As suggested earlier, export should reuse `camel run`'s repository parsing. That means a small shared helper in `camel-tooling-maven`, used by both `MavenDownloaderImpl` and export, for the comma split, `id=url`, alias resolution (`redhat`, `central`, …) and the `camel.default.extra.repos.default.value` fallback. It would also fix the remaining differences between the two commands. A follow-up JIRA seems fine for that; the minimal fix above is enough for this PR and its 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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on code in PR #26293:
URL: https://github.com/apache/camel/pull/26293#discussion_r3987852195
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -1267,8 +1278,12 @@ protected String getMavenRepositories(Path settings, Properties prop, String cam
Set<String> answer = new LinkedHashSet<>();
String propRepositories = prop.getProperty(REPOS);
+ if (propRepositories == null) {
+ // fallback to system property
+ propRepositories = System.getProperty(REPOS);
+ }
if (propRepositories != null) {
- answer.add(propRepositories);
+ Collections.addAll(answer, propRepositories.split("\\s*,\\s*"));
Review Comment:
Sorry there was a missed code in this commit.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #26293:
URL: https://github.com/apache/camel/pull/26293#discussion_r3987818275
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -1267,8 +1278,12 @@ protected String getMavenRepositories(Path settings, Properties prop, String cam
Set<String> answer = new LinkedHashSet<>();
String propRepositories = prop.getProperty(REPOS);
+ if (propRepositories == null) {
+ // fallback to system property
+ propRepositories = System.getProperty(REPOS);
+ }
if (propRepositories != null) {
- answer.add(propRepositories);
+ Collections.addAll(answer, propRepositories.split("\\s*,\\s*"));
Review Comment:
🔴 **Regression: duplicate repository IDs** — still not fixed.
`propRepositories` is a comma-joined string (e.g. `atlassian=https://...,https://.../snapshots/`), added as **one** element to the `LinkedHashSet`. But `mavenResolver.repos()` (line 1304) is split into individual entries. The set can't de-duplicate because `"atlassian=https://...,https://.../snapshots/"` ≠ `"atlassian=https://..."`. With `id=url` format, `buildRepositoryList` generates duplicate IDs → Maven rejects the POM.
Reproducer: `camel export --runtime=spring-boot --repos=atlassian=https://packages.atlassian.com/maven-external/,https://repository.apache.org/snapshots/`
```suggestion
Collections.addAll(answer, propRepositories.split("\\s*,\\s*"));
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5631232826
@davsclaus I'd like to have the backport in 4.22.1, will it be possible ?
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #26293:
URL: https://github.com/apache/camel/pull/26293#discussion_r3987547129
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -1289,6 +1304,17 @@ protected String getMavenRepositories(Path settings, Properties prop, String cam
Collections.addAll(answer, this.mavenResolver.repos().split(","));
Review Comment:
💡 For consistency with the `extraRepos` split (line 1310) and the fix above, this should also trim whitespace around commas:
```suggestion
Collections.addAll(answer, this.mavenResolver.repos().split("\\s*,\\s*"));
```
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -1267,6 +1278,10 @@ protected String getMavenRepositories(Path settings, Properties prop, String cam
Set<String> answer = new LinkedHashSet<>();
String propRepositories = prop.getProperty(REPOS);
+ if (propRepositories == null) {
+ // fallback to system property
+ propRepositories = System.getProperty(REPOS);
+ }
if (propRepositories != null) {
answer.add(propRepositories);
Review Comment:
🔴 **Regression: duplicate repository IDs** — confirmed by Croway's reproducer.
`propRepositories` is a comma-joined string (e.g. `atlassian=https://...,https://.../snapshots/`), added as **one** element. But `mavenResolver.repos()` (line 1304) is split into individual entries. The `LinkedHashSet` can't de-duplicate because `"atlassian=https://...,https://.../snapshots/"` ≠ `"atlassian=https://..."`. Every repo appears twice in the POM, and with `id=url` format, Maven rejects the duplicate IDs.
Reproducer: `camel export --runtime=spring-boot --repos=atlassian=https://packages.atlassian.com/maven-external/,https://repository.apache.org/snapshots/`
```suggestion
Collections.addAll(answer, propRepositories.split("\\s*,\\s*"));
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #26293:
URL: https://github.com/apache/camel/pull/26293#discussion_r3987810770
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java:
##########
@@ -1267,6 +1278,10 @@ protected String getMavenRepositories(Path settings, Properties prop, String cam
Set<String> answer = new LinkedHashSet<>();
String propRepositories = prop.getProperty(REPOS);
+ if (propRepositories == null) {
+ // fallback to system property
+ propRepositories = System.getProperty(REPOS);
+ }
if (propRepositories != null) {
answer.add(propRepositories);
Review Comment:
🔴 **Still not fixed:** `propRepositories` is added as a single comma-joined string (e.g. `"atlassian=https://...,https://.../snapshots/"`). When the same repos are also added individually via `mavenResolver.repos().split(",")` at line 1304, the `LinkedHashSet` can't deduplicate across these two forms — every repo appears twice in the final POM. With `id=url` format, this produces duplicate repository IDs that Maven rejects.
Croway's reproducer: `camel export --runtime=spring-boot --repos=atlassian=https://packages.atlassian.com/maven-external/,https://repository.apache.org/snapshots/`
```suggestion
Collections.addAll(answer, propRepositories.split("\\s*,\\s*"));
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer merged PR #26293:
URL: https://github.com/apache/camel/pull/26293
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24681: camel-jbang export add to pom.xml repos from properties camel.jbang.repos and camel.extra.repos [camel]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway commented on PR #26293:
URL: https://github.com/apache/camel/pull/26293#issuecomment-5631256007
Thanks for fixing this! One suggestion before merge: `camel run` and `camel export` currently read the same repository settings in two different ways, and this PR adds a third reader. Some differences on the branch:
- Export doesn't turn short names like `redhat` or `central` into URLs. Run does, via `RepositoryResolver`, so `-Dcamel.extra.repos=redhat` produces `<url>redhat</url>`.
- Export ignores the `camel.default.extra.repos.default.value` fallback that `MavenDownloaderImpl.loadExtraDefaultRepositories` uses.
- The two commands detect `id=url` differently (`indexOf('/') > eq` vs `!startsWith("http")`).
- `ExportSpringBoot.legacyMavenRepositoriesAsPomXml` doesn't split `id=url`. With an older camel-spring-boot catalog that ships `spring-boot-pom.tmpl`, `camel.extra.repos=atlassian=https://…` produces `<url>atlassian=https://…</url>`.
- Export now reads `camel.jbang.repos` as a system property, but `camel run` only reads it from `application.properties`.
Could export reuse what run does, rather than parsing again? Reading the configured `MavenDownloader`'s repositories wouldn't work, because by then settings.xml mirrors and profile repositories have been merged in. Instead, the parsing in `MavenDownloaderImpl.configureRepositories` / `loadExtraDefaultRepositories` could move into a small public helper in `camel-tooling-maven`. It would return id/url pairs and handle the comma split, short-name resolution, `id=url` and the property fallback. `MavenDownloaderImpl` would build its repositories from that list, and `buildRepositoryList` plus the legacy Spring Boot template would render the same list. That would fix the points above in one place and keep the two commands aligned.
_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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org