Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
2.5.2
-
None
-
None
-
Patch
Description
I have a project that is failing release:prepare with the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project test-parent: The artifact (test:test-module1) requires a different version (1.0) than what is found (${project.version}) for the expression (dependency.version) in the project (test:test-parent). -> [Help 1]
The reason is that there are some dependency versions specified with recursive properties like this:
<properties> <dependency.version>${project.version}</dependency.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>test</groupId> <artifactId>test-module1</artifactId> <version>${dependency.version}</version> </dependency> ...
The problem is that the plugin is resolving ${dependency.version} to ${project.version}, but it is not taking the next step and resolving ${project.version}.
I will attach a test project that demonstrates this behavior, and a patch to fix the problem.
The full command used on the test project to demonstrate the error is
mvn -e --batch-mode org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare
The output is:
[INFO] Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] test-parent [INFO] test-module1 [INFO] test-module2 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building test-parent 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-release-plugin:2.5.2:prepare (default-cli) @ test-parent --- [INFO] Verifying that there are no local modifications... [INFO] ignoring changes on: **\release.properties, **\pom.xml.next, **\pom.xml.releaseBackup, **\pom.xml.backup, **\pom.xml.branch, **\pom.xml.tag [INFO] Executing: cmd.exe /X /C "git rev-parse --show-toplevel" [INFO] Working directory: E:\test-project [INFO] Could not resolve toplevel [INFO] Executing: cmd.exe /X /C "git status --porcelain ." [INFO] Working directory: E:\test-project [INFO] nothing added to commit but untracked files present (use "git add" to track) [INFO] Checking dependencies and plugins for snapshots ... [INFO] Transforming 'test-parent'... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] test-parent ....................................... FAILURE [1.044s] [INFO] test-module1 ...................................... SKIPPED [INFO] test-module2 ...................................... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.242s [INFO] Finished at: Fri Aug 21 18:10:42 PDT 2015 [INFO] Final Memory: 10M/231M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project test-parent: The artifact (test:test-module1) requires a different version (1.0) than what is found (${project.version}) for the expression (dependency.version) in the project (test:test-parent). -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project test-parent: The artifact (test:test-module1) requires a different version (1.0) than what is found (${project.version}) for the expression (dependency.version) in the project (test:test-parent). at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213) 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:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) Caused by: org.apache.maven.plugin.MojoFailureException: The artifact (test:test-module1) requires a different version (1.0) than what is found (${project.version}) for the expression (dependency.version) in the project (test:test-parent). 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:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: org.apache.maven.shared.release.ReleaseFailureException: The artifact (test:test-module1) requires a different version (1.0) than what is found (${project.version}) for the expression (dependency.version) in the project (test:test-parent). at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.rewriteArtifactVersions(AbstractRewritePomsPhase.java:582) at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformDocument(AbstractRewritePomsPhase.java:293) 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.execute(AbstractRewritePomsPhase.java:116) at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234) 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) ... 22 more [ERROR] [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Attachments
Attachments
Issue Links
- duplicates
-
MRELEASE-913 Nested properties in versions cause prepare to fail
- Open