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

   ### Affected version
   
   3.10.0
   
   ### Bug description
   
   Not certain if this is a bug or intended hardening, try running this test on 
3.9.16 and 3.10.0
   
   ```java
   import static org.junit.jupiter.api.Assertions.assertEquals;
   
   import java.nio.file.Files;
   import java.nio.file.Path;
   import java.util.Properties;
   
   import org.apache.maven.model.Model;
   import org.apache.maven.model.building.DefaultModelBuilderFactory;
   import org.apache.maven.model.building.DefaultModelBuildingRequest;
   import org.apache.maven.model.building.ModelBuildingRequest;
   import org.apache.maven.model.building.ModelBuilder;
   import org.junit.jupiter.api.Test;
   import org.junit.jupiter.api.io.TempDir;
   
   class ProfileActivationViaProperty {
   
       @TempDir
       Path tempDir;
   
       @Test
       void propertyActivatedProfileSetsSecondProperty() throws Exception {
           Path pomFile = tempDir.resolve("pom.xml");
   
           Files.writeString(pomFile, """
               <project xmlns="http://maven.apache.org/POM/4.0.0";
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                        xsi:schemaLocation="
                          http://maven.apache.org/POM/4.0.0
                          https://maven.apache.org/xsd/maven-4.0.0.xsd";>
   
                   <modelVersion>4.0.0</modelVersion>
   
                   <groupId>example</groupId>
                   <artifactId>profile-test</artifactId>
                   <version>${v}</version>
   
                   <profiles>
                       <profile>
                           <id>foo</id>
   
                           <activation>
                               <property>
                                   <name>activate.foo</name>
                                   <value>true</value>
                               </property>
                           </activation>
   
                           <properties>
                               
<second.property>profile-was-activated</second.property>
                           </properties>
                       </profile>
                   </profiles>
               </project>
               """);
   
           Properties userProperties = new Properties();
           userProperties.setProperty("activate.foo", "true");
           userProperties.setProperty("v", "666");
           
           // required for 1) to pass
           // tells maven 3.10 to add props as interpolation value source
           
userProperties.setProperty("maven.model.dependencyInterpolation.full", "true");
           
           
           ModelBuildingRequest request = new DefaultModelBuildingRequest()
                   .setPomFile(pomFile.toFile())
                   .setUserProperties(userProperties)
                   
.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
   
           ModelBuilder modelBuilder = new 
DefaultModelBuilderFactory().newInstance();
   
           Model effectiveModel = modelBuilder
                   .build(request)
                   .getEffectiveModel();
   
           // 1)
           assertEquals(
                   "666",
                   effectiveModel.getVersion()
           );
   
           // 2) fails on 3.10 despite 
"maven.model.dependencyInterpolation.full"
           assertEquals(
                   "profile-was-activated",
                   effectiveModel.getProperties().getProperty("second.property")
           );
       }
   }
   ```


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