mikera
mikera

Reputation: 106351

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] - 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?

Upvotes: 13

Views: 12027

Answers (4)

aglavina
aglavina

Reputation: 395

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

Upvotes: 6

Aravind R
Aravind R

Reputation: 766

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

Upvotes: 5

kamuflage661
kamuflage661

Reputation: 519

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.

Upvotes: 6

Nicola Musatti
Nicola Musatti

Reputation: 18218

You might be able to overcome the error you mention by installing command line Maven and configure Eclipse to use that rather than the embedded one by choosing Window -> Preferences -> Maven -> Installations, but I agree with the advice of making your releases outside Eclipse.

Upvotes: 3

Related Questions