You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Roman Ivanov (Jira)" <ji...@apache.org> on 2019/10/24 12:54:00 UTC

[jira] [Commented] (MRELEASE-799) update-versions fails when the project artifact is used with a version other than the current snapshot

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

Roman Ivanov commented on MRELEASE-799:
---------------------------------------

issue is still reproducible. See details on attempt to bump version of plugin in checkstyle project - https://github.com/checkstyle/checkstyle/pull/7217
Yes we use different version of ourself/itself in special plugin, but it is valid usage.

To reproduce, bump maven-release-plugin version to 2.5.3
Command:
{code}
mvn -e release:prepare -DdryRun=true --batch-mode -Darguments='-DskipTests -DskipITs \
      -Djacoco.skip=true -Dpmd.skip=true -Dspotbugs.skip=true -Dxml.skip=true \
      -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dgpg.skip=true'
{code}
output:
{code}
[INFO] ------------------------------------------------------------------------
[INFO] Building checkstyle 8.26-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-release-plugin:2.5.3:prepare (default-cli) @ checkstyle ---
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **/pom.xml.releaseBackup, **/pom.xml.next, **/pom.xml.tag, **/pom.xml.branch, **/release.properties, **/pom.xml.backup
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/github/romani/checkstyle && git rev-parse --show-toplevel
[INFO] Working directory: /home/rivanov/java/github/romani/checkstyle
[INFO] Executing: /bin/sh -c cd /home/rivanov/java/github/romani/checkstyle && git status --porcelain .
[INFO] Working directory: /home/rivanov/java/github/romani/checkstyle
[WARNING] Ignoring unrecognized line: ?? release.properties
[INFO] Checking dependencies and plugins for snapshots ...
[INFO] Transforming 'checkstyle'...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.337 s
[INFO] Finished at: 2019-10-24T05:44:02-07:00
[INFO] Final Memory: 21M/384M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project checkstyle: The artifact (com.puppycrawl.tools:checkstyle) requires a different version (8.26) than what is found (8.18) for the expression (maven.sevntu-checkstyle-check.checkstyle.version) in the project (com.puppycrawl.tools:checkstyle). -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project checkstyle: The artifact (com.puppycrawl.tools:checkstyle) requires a different version (8.26) than what is found (8.18) for the expression (maven.sevntu-checkstyle-check.checkstyle.version) in the project (com.puppycrawl.tools:checkstyle).
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: The artifact (com.puppycrawl.tools:checkstyle) requires a different version (8.26) than what is found (8.18) for the expression (maven.sevntu-checkstyle-check.checkstyle.version) in the project (com.puppycrawl.tools:checkstyle).
	at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:294)
	at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:240)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: org.apache.maven.shared.release.ReleaseFailureException: The artifact (com.puppycrawl.tools:checkstyle) requires a different version (8.26) than what is found (8.18) for the expression (maven.sevntu-checkstyle-check.checkstyle.version) in the project (com.puppycrawl.tools:checkstyle).
	at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.rewriteArtifactVersions(AbstractRewritePomsPhase.java:582)
	at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformDocument(AbstractRewritePomsPhase.java:310)
	at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformProject(AbstractRewritePomsPhase.java:231)
	at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transform(AbstractRewritePomsPhase.java:131)
	at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.simulate(AbstractRewritePomsPhase.java:704)
	at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:228)
	at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)
	at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)
	at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)
	at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:286)
	... 23 more

{code}


Workaround still valid:
do not use variables for version, keep version in dependency.
To avoid problem following patch can be used:
{code}
$ git diff
diff --git a/pom.xml b/pom.xml
index 71bbe6d..004b851 100644
--- a/pom.xml
+++ b/pom.xml
@@ -558,7 +558,7 @@
           <dependency>
             <groupId>com.puppycrawl.tools</groupId>
             <artifactId>checkstyle</artifactId>
-            <version>${maven.sevntu-checkstyle-check.checkstyle.version}</version>
+            <version>8.18</version>
           </dependency>
         </dependencies>
         <!-- Specifying configuration here will take effect on the execution
{code}


> update-versions fails when the project artifact is used with a version other than the current snapshot
> ------------------------------------------------------------------------------------------------------
>
>                 Key: MRELEASE-799
>                 URL: https://issues.apache.org/jira/browse/MRELEASE-799
>             Project: Maven Release Plugin
>          Issue Type: Bug
>          Components: update-versions
>    Affects Versions: 2.3.2
>         Environment: maven 2.2.1, maven 3.0.3
>            Reporter: Péter Miklós
>            Priority: Major
>         Attachments: MRELEASE-799.zip
>
>
> If a maven project uses its own artifact eg. as a dependency of a plugin with a version other than the current snapshot then release:update-versions will fail with an error like this:
> bq. The artifact (com.example:test) requires a different version (3.1.50) than what is found (3.1.49) for the expression (lastReleasedProjectVersion) in the project (com.example:test)
> Basically, the latest release of the same artifact is used for some sort of regression testing and it seems that the update-versions, after moving to the next release version from snapshot, notices that there is a discrepancy between the new release version and the version used as a plugin dependency.
> This error popped up when I started to use release plugin 2.2.2 and as a result of MRELEASE-412 the properties used in the version tag are also updated.
> I think the update-versions should remember which artifacts have been updated from snapshot to the new release version, and then check those only.



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