Claus Ibsen created CAMEL-27508:
-----------------------------------
Summary: Upgrade to Maven 3.10.x APIs (maven-version) together
with Maven Resolver 2.x
Key: CAMEL-27508
URL: https://issues.apache.org/jira/browse/CAMEL-27508
Project: Camel
Issue Type: Task
Components: build system
Reporter: Claus Ibsen
Fix For: 4.x
Dependabot proposed bumping the {{maven-version}} property from 3.9.16 to
3.10.2 (https://github.com/apache/camel/pull/30710). That bump is not safe on
its own and the PR was closed.
h3. Why
Maven 3.10.x is built on Maven Resolver 2.x (the Maven 3.10.2 parent pom has
{{resolverVersion}} 2.0.26), but Camel pins {{maven-resolver-version}} to
1.9.27 in {{parent/pom.xml}}, and {{tooling/camel-tooling-maven}} declares the
resolver jars with that version next to {{maven-resolver-provider}}
{{${maven-version}}}.
Checking the 3.10.2 {{maven-resolver-provider}} jar against the resolver 1.9.27
jars:
*
{{org.apache.maven.repository.internal.metadata.ValidatingMetadataXpp3Reader}}
calls {{org.eclipse.aether.util.PathUtils.validatePathComponent(String,
String)}}, which does not exist in resolver-util 1.9.27 (its {{PathUtils}} only
has {{stringToPathSegment}}). The reader is used by {{DefaultVersionResolver}},
{{DefaultVersionRangeResolver}} and {{MavenMetadata}}, so reading a
{{maven-metadata.xml}} (SNAPSHOT or version-range resolution) would fail with
{{NoSuchMethodError}}. {{MavenDownloaderImpl}} (the Camel CLI downloader, MIMA
standalone-static) resolves SNAPSHOTs from the Apache snapshot repository, so
{{camel run}} with a SNAPSHOT dependency is the likely place this shows up, and
probably not in the unit tests.
* The new {{org.apache.maven.repository.supplier}} classes
({{RepositorySystemSupplier}}, {{SessionBuilderSupplier}},
{{Maven3ScopeManagerConfiguration}}) reference about 60 resolver 2.x-only types
({{RepositorySystemSession$SessionBuilder}}, {{org.eclipse.aether.scope.*}},
{{PipelineRepositoryConnectorFactory}}, ...). Camel does not use them today.
h3. What to do
* Move {{maven-version}} to 3.10.x and {{maven-resolver-version}} to 2.x in the
same change.
* Check MIMA: 2.4.48 is the resolver 1.9 line; a resolver 2.x based MIMA is
needed.
* Check the wiring in {{camel-tooling-maven}} ({{MavenDownloaderImpl}},
{{ArtifactDescriptorReaderDelegate}} use) and {{camel-launcher}}, which bundles
the Maven artifacts.
* Test {{camel run}} with a SNAPSHOT dependency and with a version range, not
only the unit tests.
* The Maven plugins in tooling ({{camel-report-maven-plugin}},
{{camel-yaml-dsl-validator-maven-plugin}}, {{camel-repackager-maven-plugin}})
also compile against {{maven-version}}.
The user-facing Maven minimum is not affected: {{requiredMavenVersion}} of the
Camel Maven plugins is pinned to 3.9.12 since
https://github.com/apache/camel/pull/30442, independent of {{maven-version}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)