Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.12.0 - allowSnapshots don't find last snapshot with plugin version 2.12.0 #690

Closed
ndaussy opened this issue Sep 14, 2022 · 4 comments · Fixed by #706
Closed

2.12.0 - allowSnapshots don't find last snapshot with plugin version 2.12.0 #690

ndaussy opened this issue Sep 14, 2022 · 4 comments · Fixed by #706

Comments

@ndaussy
Copy link

ndaussy commented Sep 14, 2022

Hello,

Since last release (2.12.0) few day ago, update-parent goal don't find last snapshot push.
mvn version:update-parent "DparentVersion=[0,2.76-SNAPSHOT]" -DallowSnapshots=true -U

We force to use 2.11.0 and plugin found last snapshot version.
mvn org.codehaus.mojo:version-maven-plugin:2.11.0:update-parent "DparentVersion=[0,2.76-SNAPSHOT]" -DallowSnapshots=true -U

Something have change with allowSnapshots to allow him to check snapshot version ?

@andrzejj0
Copy link
Contributor

Looking into it.

@andrzejj0
Copy link
Contributor

Similar to #670, fixed by PR #671

Verified by:

  1. maven on versions-maven-plugin:
mvn org.codehaus.mojo:versions-maven-plugin:2.12.1-SNAPSHOT:update-parent -DallowSnapshots=true "-DparentVersion=[0,71-SNAPSHOT]"
  1. created an it with a test similar to above

  2. created a unit test:

    @Test
    public void testShouldUpgradeToSnapshot() throws MojoExecutionException, XMLStreamException, MojoFailureException
    {
        mojo.getProject().setParent( new MavenProject()
        {{
            setGroupId( "default-group" );
            setArtifactId( "parent-artifact" );
            setVersion( "0.9.0" );
        }} );
        mojo.allowSnapshots = true;
        mojo.parentVersion = "[0,1.0.1-SNAPSHOT]";
        try ( MockedStatic<PomHelper> pomHelper = mockStatic( PomHelper.class ) )
        {
            pomHelper.when( () -> PomHelper.setProjectParentVersion( any(), any() ) ).thenReturn( true );
            mojo.update( null );
        }
        assertThat( changeRecorder.getChanges(),
                hasItem( new VersionChange( "default-group", "parent-artifact", "0.9.0",
                        "1.0.1-SNAPSHOT" ) ) );
    }

Appears to be fixed.

@andrzejj0
Copy link
Contributor

andrzejj0 commented Sep 14, 2022

@slawekjaranowski should I add this unit test to the suite? (will slow down compilation ever so slightly ;) )

@slachiewicz
Copy link
Member

yes, please open PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants