ponziani opened a new pull request, #2979:
URL: https://github.com/apache/karaf/pull/2979

   Fixes [KARAF-7667](https://issues.apache.org/jira/browse/KARAF-7667).
   
   ## Problem
   
   Since Maven 3.9 (Maven Resolver 1.9) the local repository can be split into 
installed and cached artifacts. These can be split further into releases and 
snapshots and by remote repository. The `aether.enhancedLocalRepository.*` 
properties control this 
([docs](https://maven.apache.org/resolver/local-repository.html#split-local-repository)).
   
   The `assembly` and `verify` goals of the karaf-maven-plugin resolve 
artifacts through pax-url, not through Maven's resolver. pax-url only receives 
the plain local repository directory. When Maven uses a split local repository, 
the plugin therefore can't find the artifacts installed by the build itself 
(typically SNAPSHOTs): they live under `installed/...`, while pax-url only 
looks in the root.
   
   As discussed in 
[ops4j/org.ops4j.pax.url#417](https://github.com/ops4j/org.ops4j.pax.url/issues/417#issuecomment-1500427845),
 `Builder#createMavenResolver()` only passes `offline`, `localRepository` and 
`repositories` to pax-url.
   
   ## Fix
   
   Pax URL 2.7 / 3.x supports split local repositories through options on the 
`localRepository` value, for example 
`/path/to/repository@id=local@split@splitLocal`. pax-url maps these options 
one-to-one to the same `aether.enhancedLocalRepository.*` resolver properties.
   
   - `MojoSupport#getPaxUrlLocalRepository()` reads the split configuration 
from the Maven session (`RepositorySystemSession#getConfigProperties()`). It 
appends the matching pax-url options: `split`, `splitLocal`, `splitRemote`, 
`splitRemoteRepository`, `splitRemoteRepositoryLast`, and the `localPrefix` / 
`remotePrefix` / `releasesPrefix` / `snapshotsPrefix` values.
   - `AssemblyMojo` (through `Builder#localRepository`) and `VerifyMojo` use 
this value.
   - Without a split local repository, the value is unchanged (plain 
directory), so existing builds behave as before.
   
   This also fixes a small bug in `Builder#createMavenResolver()`: the offline 
property was `org.ops4j.pax.url.mvn` + `"offline"` (no dot), so `mvn -o` was 
never passed on to pax-url.
   
   ## Tests
   
   New `MojoSupportTest`:
   
   - checks the generated `localRepository` value with and without split 
configuration;
   - builds a split local repository the way Maven 3.9 lays it out 
(`installed/snapshots/...`) and resolves a SNAPSHOT from it with an offline 
pax-url resolver. It asserts that the artifact is **not** found with the plain 
directory (the current behaviour), and **is** found with the generated value.
   
   `mvn -pl profile,tooling/karaf-maven-plugin install -Dinvoker.skip=true`: 
all unit tests pass. The invoker integration tests and a full assembly build 
with Maven in split mode were not run locally.
   
   ## Backport
   
   `karaf-4.4.x` uses Pax URL 2.7.1, which supports the same split options, so 
the change should apply there as well.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to