Maven Release Plugin
  1. Maven Release Plugin
  2. MRELEASE-459

releaseProfiles has no effect without passing profiles in the command line

    Details

    • Flags:
      Patch

      Description

      The releaseProfiles parameter on the perform goal is not taken into consideration when no other profiles are passed in the command line. In other words, the current code only uses the value of the parameter if you have additional profiles passed in.

      Example:

      mvn release:perform -P someProfile (uses releaseProfiles value)

      mvn release:perform (does NOT use releaseProfiles value)

      The plugin should use the parameter even if no other profiles are passed. It should actually encourage release profiles configured in your POM as opposed to arbitrary profiles passed in the command line.

      I have included a patch that uses the releaseProfiles parameter regardless of any profiles passed in the command line.

      1. MRELEASE-459.1.patch
        1 kB
        Lars Francke
      2. patch.txt
        1 kB
        Andreas Christoforides

        Activity

        Andreas Christoforides created issue -
        Hide
        Dominic Mitchell added a comment -

        Just a pointer. I got caught out by this unexpectedly. It turned out that on one machine, I didn't have any profiles present in my settings.xml.

        If you want to reproduce this, try temporarily moving your settings.xml out of the way.

        Show
        Dominic Mitchell added a comment - Just a pointer. I got caught out by this unexpectedly. It turned out that on one machine, I didn't have any profiles present in my settings.xml . If you want to reproduce this, try temporarily moving your settings.xml out of the way.
        Hide
        Johan Walles added a comment -

        Hi!

        What remains to be done before this patch can be incorporated in the release plugin?

        I just got hit by this and I'd really appreciate if this could be fixed.

        Regards /Johan

        Show
        Johan Walles added a comment - Hi! What remains to be done before this patch can be incorporated in the release plugin? I just got hit by this and I'd really appreciate if this could be fixed. Regards /Johan
        Hide
        Karl M. Davis added a comment -

        I actually had to use the following to get things to work:
        mvn release:perform -Darguments="-PmyProfileToActivate"

        I think this is because I'm also using the -DconnectionUrl=... option and don't have any profiles defined in my settings.xml.

        Show
        Karl M. Davis added a comment - I actually had to use the following to get things to work: mvn release:perform -Darguments="-PmyProfileToActivate" I think this is because I'm also using the -DconnectionUrl=... option and don't have any profiles defined in my settings.xml .
        Hide
        Torsten Reinhard added a comment -

        I ran into a comparable problem:
        I´ve had a 'local' profile, which was activated by default.
        At mvn release:perform I want the profile 'release' to be activated - but what happened was that both profiles ('local' and 'release') were activated, trying to set the same variable.
        My solution was, to remove the 'local' profile, which was activated by default before.

        but then, at mvn release:perform no more profiles got activated:
        [DEBUG] Executing: cmd.exe /X /C "C:\eap\apache-maven-2.2.1\bin\mvn.bat -X -D maven.repo.local=D:\mavenrepo -f maven-release-test -D performRelease=true deploy site-deploy"

        => So i now added a 'dummy' profile that is activated by default, but does nothing:
        [DEBUG] Executing: cmd.exe /X /C "C:\eap\apache-maven-2.2.1\bin\mvn.bat -X -D maven.repo.local=D:\mavenrepo -f maven-release-test -D performRelease=true -P dummy,release deploy site-deploy"

        using this workaround, I got my 'release' profile to work - after spending some hours with this issue....Please, fix that in one of the next releases or give a hint in the documentation.

        Thanx, Torsten

        Show
        Torsten Reinhard added a comment - I ran into a comparable problem: I´ve had a 'local' profile, which was activated by default. At mvn release:perform I want the profile 'release' to be activated - but what happened was that both profiles ('local' and 'release') were activated, trying to set the same variable. My solution was, to remove the 'local' profile, which was activated by default before. but then, at mvn release:perform no more profiles got activated: [DEBUG] Executing: cmd.exe /X /C "C:\eap\apache-maven-2.2.1\bin\mvn.bat -X -D maven.repo.local=D:\mavenrepo -f maven-release-test -D performRelease=true deploy site-deploy" => So i now added a 'dummy' profile that is activated by default, but does nothing: [DEBUG] Executing: cmd.exe /X /C "C:\eap\apache-maven-2.2.1\bin\mvn.bat -X -D maven.repo.local=D:\mavenrepo -f maven-release-test -D performRelease=true -P dummy,release deploy site-deploy" using this workaround, I got my 'release' profile to work - after spending some hours with this issue....Please, fix that in one of the next releases or give a hint in the documentation. Thanx, Torsten
        Hide
        Chris Watts added a comment -

        This also seems to effect maven3 maven-release-plugin:2.2.1

        Not sure if it's to do with running maven thus:
        mvn release:prepare release:perform

        Show
        Chris Watts added a comment - This also seems to effect maven3 maven-release-plugin:2.2.1 Not sure if it's to do with running maven thus: mvn release:prepare release:perform
        Hide
        Lars Francke added a comment -

        This is the exact same patch as before just created against the new directory layout.

        All tests still pass.

        Show
        Lars Francke added a comment - This is the exact same patch as before just created against the new directory layout. All tests still pass.
        Lars Francke made changes -
        Field Original Value New Value
        Attachment MRELEASE-459.1.patch [ 58268 ]
        Hide
        Stephen Connolly added a comment -

        Needs some integration tests that fail before the patch is applied and pass after the patch is applied to:

        1. prove there is an issue

        2. prove the issue is fixed

        3. prevent the issue from arising again.

        I know this looks like a simple fix, but we really need integration tests to apply patches or quality will just decrease

        Show
        Stephen Connolly added a comment - Needs some integration tests that fail before the patch is applied and pass after the patch is applied to: 1. prove there is an issue 2. prove the issue is fixed 3. prevent the issue from arising again. I know this looks like a simple fix, but we really need integration tests to apply patches or quality will just decrease
        stephenconnolly made changes -
        Labels contributers-welcome help-requested missing-integration-tests
        Hide
        Lars Francke added a comment -

        Thanks for the comment and the explanation.

        If no one else jumps on it before I'll try to provide an updated patch but I can't commit to a date yet. Need to understand how ITs work here first, too.

        Show
        Lars Francke added a comment - Thanks for the comment and the explanation. If no one else jumps on it before I'll try to provide an updated patch but I can't commit to a date yet. Need to understand how ITs work here first, too.
        Hide
        Martin Todorov added a comment - - edited

        This works fine under version 2.2.2 of the plugin. I am actively using it. I think it can be closed.

        Show
        Martin Todorov added a comment - - edited This works fine under version 2.2.2 of the plugin. I am actively using it. I think it can be closed.
        Hide
        Robert Scholte added a comment -

        @Martin, it looks like the releaseProfiles are only passed when there's at least one other active profile, so it doesn't have to be a problem for everybody. Like Stephen already said before: first proof with an IT that this is still an issue.

        Show
        Robert Scholte added a comment - @Martin, it looks like the releaseProfiles are only passed when there's at least one other active profile, so it doesn't have to be a problem for everybody. Like Stephen already said before: first proof with an IT that this is still an issue.
        Hide
        Andrei Pozolotin added a comment -

        fyi: this is still a problem as of 2.3.2;

        hey, this soon will make it into a book of records!
        it will be named: "the curse of the maven release plugin"
        http://stackoverflow.com/questions/3291938/maven-release-plugin-ignores-releaseprofile

        workaround is still the same: put a dummy profile in settings.xml

        settings.xml
        
        <profiles>
        	<profile>
        		<id>default</id>
        	</profile>
        </profiles>
        
        <activeProfiles>
        	<activeProfile>default</activeProfile>
        </activeProfiles>
        
        
        Show
        Andrei Pozolotin added a comment - fyi: this is still a problem as of 2.3.2; hey, this soon will make it into a book of records! it will be named: "the curse of the maven release plugin" http://stackoverflow.com/questions/3291938/maven-release-plugin-ignores-releaseprofile workaround is still the same: put a dummy profile in settings.xml settings.xml <profiles> <profile> <id> default </id> </profile> </profiles> <activeProfiles> <activeProfile> default </activeProfile> </activeProfiles>
        Hide
        Robert Scholte added a comment -

        Fixed in r1391992

        Show
        Robert Scholte added a comment - Fixed in r1391992
        Robert Scholte made changes -
        Fix Version/s 2.4 [ 17453 ]
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Robert Scholte [ rfscholte ]
        Resolution Fixed [ 1 ]
        Hide
        Andrei Pozolotin added a comment -

        thank you!

        Show
        Andrei Pozolotin added a comment - thank you!
        Hide
        James Olsen added a comment -

        Note that releaseProfiles has to be in the root pom. Knowing that could save some time. Raised MRELEASE-863.

        Show
        James Olsen added a comment - Note that releaseProfiles has to be in the root pom. Knowing that could save some time. Raised MRELEASE-863 .
        Mark Thomas made changes -
        Project Import Sun Apr 05 12:15:05 UTC 2015 [ 1428236105845 ]
        Mark Thomas made changes -
        Workflow jira [ 12724277 ] Default workflow, editable Closed status [ 12763493 ]
        Mark Thomas made changes -
        Patch Submitted Yes [ 10763 ]
        Flags Patch [ 10430 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 00:52:26 UTC 2015 [ 1428281546237 ]
        Mark Thomas made changes -
        Workflow jira [ 12962026 ] Default workflow, editable Closed status [ 12999270 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        1175d 2h 21m 1 Robert Scholte 30/Sep/12 07:11

          People

          • Assignee:
            Robert Scholte
            Reporter:
            Andreas Christoforides
          • Votes:
            23 Vote for this issue
            Watchers:
            23 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development