简体   繁体   中英

Using maven-release-plugin in Eclipse

I recently tried to use maven-release-plugin since it is apparently the recommended way of building and packages releases in the Maven universe.

However I wanted to use this within Eclipse, as the rest of my development workflow is Eclipse based. I normally run Maven commands via the m2eclipse plugin provided as part of Eclipse Juno (4.2)

I noticed a few oddities when I tried to run "release:prepare" within Eclipse:

  1. Some extra files were created in the root project directory - "pom.xml.releaseBackup" and "release.properties". Do they really belong there? Have I got the release directories set up correctly? I wouldn't really consider these temporary artifacts as part of my source code tree......
  2. The pom.xml gets manually overwritten with the updated release number. Eclipse warns you and is happy to reload the updated version - but is this generally safe?
  3. The prepare ultimately fails giving the error [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project clisk: Failed to invoke Maven build. Error configuring command-line. Reason: Maven executable not found at: C:\\Users\\Mike\\git\\clisk\\EMBEDDED\\bin\\mvn.bat -> [Help 1] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project clisk: Failed to invoke Maven build. Error configuring command-line. Reason: Maven executable not found at: C:\\Users\\Mike\\git\\clisk\\EMBEDDED\\bin\\mvn.bat -> [Help 1] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project clisk: Failed to invoke Maven build. Error configuring command-line. Reason: Maven executable not found at: C:\\Users\\Mike\\git\\clisk\\EMBEDDED\\bin\\mvn.bat -> [Help 1] - presumably because I am using the built-in Maven excetable provided by m2eclipse rather than the command line. I guess I could install command line maven as well.... but is that sensible or will it just cause more problems?

Given these kind of issues, Is there a way to get maven-release-plugin to work smoothly within Eclipse, or should I just give up and continue to do releases manually?

I have been using release plugin, but only from command line.

Re. 1. The backup files that release plugin creates are needed if something goes wrong in time of preparing the release. You can always rollback the prepared release using release:rollback command. When you do release:perform they will be deleted.

Re. 2. The plugin changes the version number from snapshot version for example: 0.0.1-SNAPSHOT: to release version: 0.0.1. Then after release:perform release version is moved to the maven repository and release plugin changes version again to 0.0.2-SNAPSHOT. Now you can use you full released (tested) version in your testing or production enviornment and snapshot version for developping purposes.

Re. 3. I don't know what is causing the problem, but I don't see the problem by using release plugin from command line.

Also mvn 3.3.3 installs a mvn.cmd file, instead of a mvn.bat file in Windows.

You should copy mvn.cmd to mvn.bat

Well i know this link is OLD , but to help some on who reffers this link for the issue 3.

Install maven separately on to local Box and give the path of the installation under Windows->Preferences--> maven--> Installation. Also you have to define the same in the run configuration within the Eclipse.

Attached is a link that explains the same.

http://maven.40175.n5.nabble.com/Build-Failure-prepare-release-td510949.html

您可以通过安装命令行Maven并通过选择Window - > Preferences - > Maven - > Installations来配置Eclipse以使用它而不是嵌入式错误来克服您提到的错误,但我同意将您的版本发布到外部的建议日食。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM