[ 
https://issues.apache.org/jira/browse/MRELEASE-1042?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17082460#comment-17082460
 ] 

Benoit GUERIN commented on MRELEASE-1042:
-----------------------------------------

{quote}Thus when the release.properties is generated we are supposed to add the 
"releaseProfiles" but "getAdditionalProfiles()" returns null in the prepare 
Mojo (it's only implemented in perform) thus we completely lost the info
{quote}
Yep, but the release descriptor is reconstructed from scratch on perform :

[https://github.com/apache/maven-release/blob/master/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java#L170]

and the perform goals has the correct overload to append additional profiles :

[https://github.com/apache/maven-release/blob/master/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java#L140]

BUT this descriptor is then passed to the ReleaseManager, through the request 
argument :

[https://github.com/apache/maven-release/blob/master/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java#L195]

which merge it with the properties from the temporary release.properties file :

[https://github.com/apache/maven-release/blob/master/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java#L303]

[https://github.com/apache/maven-release/blob/master/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java#L78]

in this method you will see that :
 # we load properties from the release.properties file (2nd arg)
 # we reuse the descriptorBuilder passed from the perform MOJO
 # we override existing values in the builder which values from the properties. 
This IS WHERE we lost additional profiles.

 

I think we should change (again) how 
ReleaseUtils.copyPropertiesToReleaseDescriptor handle activateProfiles :

[https://github.com/apache/maven-release/blob/master/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java#L132]

and do a merge between existing values if any and those from properties

> releaseProfiles get overriden by activeProfiles
> -----------------------------------------------
>
>                 Key: MRELEASE-1042
>                 URL: https://issues.apache.org/jira/browse/MRELEASE-1042
>             Project: Maven Release Plugin
>          Issue Type: Bug
>          Components: perform
>    Affects Versions: 3.0.0-M2
>            Reporter: Arnaud Heritier
>            Assignee: Robert Scholte
>            Priority: Major
>
> I tried to release a project with 3.0.0-M2 and potentially it is another 
> problem related to MRELEASE-1038 [~rfscholte] [~olamy]
>  
> In our corporate POM we have a pluginManagement entry:
> {code:java}
> <plugin>
>   <artifactId>maven-release-plugin</artifactId>
>   <version>2.5.3</version>
>   <configuration>
>     <mavenExecutorId>forked-path</mavenExecutorId>
>     <useReleaseProfile>false</useReleaseProfile>
>     <releaseProfiles>cloudbees-internal-release</releaseProfiles>
>   </configuration>
> </plugin>
> {code}
> My project extends it and has no settings related to the release plugin
> In my user settings I have
> {code:java}
>   <activeProfiles>
>     <activeProfile>cloudbees-internal-deploy</activeProfile>
>     <activeProfile>cloudbees-snapshots</activeProfile>
>     <activeProfile>apache-staging</activeProfile>
>   </activeProfiles>
> {code}
> Then I release my project using 3.0.0-M2 with
> {code:java}
>  mvn org.apache.maven.plugins:maven-release-plugin:3.0.0-M2:prepare 
> org.apache.maven.plugins:maven-release-plugin:3.0.0-M2:perform
> {code}
> The perform step is taking my user profiles but not the ones from 
> "releaseProfiles"
> {noformat}
> [INFO] Executing: /bin/sh -c cd /Users/arnaud/some/path/target/checkout && 
> /Users/arnaud/.asdf/installs/maven/3.6.3/bin/mvn -s 
> /var/folders/bw/j0tmy8p52szfms6c7qb0tx2r0000gn/T/release-settings4094445863857985100.xml
>  -f pom.xml deploy -P 
> cloudbees-internal-deploy,cloudbees-snapshots,apache-staging -f 
> pom.xml{noformat}
> Not sure if it could be because I call the release plugin with the full GAV 
> but it is strange ...
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to