ascheman opened a new issue, #12288:
URL: https://github.com/apache/maven/issues/12288

   ### Background
   
   Apache Maven Resolver lets users configure the local repository manager
   through `aether.*` properties. The Maven user manual describes
   `<properties>` inside a `<profile>` as a regular way to set them, and
   the documented activation channels for such a profile are:
   
   - CLI: `mvn -P <id>`
   - `settings.xml`: 
`<activeProfiles><activeProfile>...</activeProfile></activeProfiles>`
   - `settings.xml`: 
`<profile><activation><activeByDefault>true</activeByDefault></activation>...`
   
   The first channel (CLI) propagates these properties to the resolver
   session as expected. The other two do not.
   
   ### Bug
   
   When a profile is activated *only* through `settings.xml` (either
   `<activeProfiles>` or `<activeByDefault>`), the properties declared in
   that profile's `<properties>` block never reach the
   `RepositorySystemSession.configProperties` that the
   `EnhancedLocalRepositoryManager` reads at initialization. Consequently,
   `aether.*` settings declared in a settings.xml profile have no effect on
   the LRM — but the *same* `<properties>` block on the *same* `<profile>`
   works correctly when the user activates it via `-P <id>`.
   
   This is observable to the user because
   `mvn help:evaluate -Dexpression=aether.enhancedLocalRepository.localPrefix`
   *does* report the configured value (the property is in the Maven session
   elsewhere), yet the LRM behaves as if no `aether.*` configuration had
   been set.
   
   ### Reproducer
   
   `pom.xml`:
   
   ```xml
   <project xmlns="http://maven.apache.org/POM/4.0.0";>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.example.aether</groupId>
     <artifactId>test-artifact</artifactId>
     <version>1.0</version>
     <packaging>pom</packaging>
   </project>
   ```
   
   `settings.xml`:
   
   ```xml
   <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0";>
     <profiles>
       <profile>
         <id>aether-split-via-settings</id>
         <activation><activeByDefault>true</activeByDefault></activation>
         <properties>
           
<aether.enhancedLocalRepository.split>true</aether.enhancedLocalRepository.split>
           
<aether.enhancedLocalRepository.localPrefix>mvb-foo</aether.enhancedLocalRepository.localPrefix>
         </properties>
       </profile>
     </profiles>
   </settings>
   ```
   
   Run:
   
   ```bash
   mvn -s settings.xml -Dmaven.repo.local=$PWD/local-repo install
   find local-repo -name 'test-artifact-1.0.pom'
   ```
   
   | | Found at |
   |---|---|
   | **Expected** (matches CLI `-P`-activated behavior) | 
`local-repo/mvb-foo/org/example/aether/test-artifact/1.0/test-artifact-1.0.pom` 
|
   | **Actual** | 
`local-repo/org/example/aether/test-artifact/1.0/test-artifact-1.0.pom` |
   
   ### Versions
   
   - Maven 4.x master (sha `09fdd6a6`, `4.1.0-SNAPSHOT`)
   - Maven 3.9.16
   
   Likely affects all versions on both lines; backport candidate.
   


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