It's all about the answers!

Ask a question

Configuring JAZZ command line Build definition to recognize Maven


Colin Duggan (15156) | asked Oct 19 '12, 12:51 p.m.
I'm running a command line build definition which calls a shell script which in turn uses maven to execute some tasks. However my build fails because the build engine can't find Maven on the Path. Is it possible to configure my build definition to recognize Maven ? I tried to do this by setting maven as one of the definitions properties however i had no success. 

Error
mvn: command not found

Accepted answer


permanent link
Ralph Schoon (63.6k33646) | answered Oct 20 '12, 7:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
 Colin, the command line build in newer versions provides an option to export the properties as environment variables. You can also use the properties in the build definition e.g. ${my property}\mvn.exe.

I would set the location property for maven ("MyMavenHome") in the build engine, to make it machine specific and then publish it as environment variable using the check box on the command line build. I can't remember when this capability was introduced.
Colin Duggan selected this answer as the correct answer

Comments
Colin Duggan commented Oct 22 '12, 4:53 a.m.

yes Maven Home is set on the build engine and i just refer to this via a property in the properties section of my build definition. The in the "command line" tab in the Environment variables section i check the "Add build properties to native environment" however this raises issues with MVN and sometimes JAVA_HOME although both are set on the build engine. (I don't refer to JAVA_HOME in my properties in the Build definition) 


Ralph Schoon commented Oct 22 '12, 5:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You can dump the properties of your build into a text file to make sure that all values are expanded, for example the external Maven_Home. External environment variables are not available to me in the build definition for expansion using ${env_var_name};

You can, on the build machine, add your folder with the Maven binaries to the path also, which would remove the issue with not finding it.

Other than that, I am not sure I can help further with the given information.




Colin Duggan commented Oct 22 '12, 4:35 p.m.

Thanks for your help Ralph. in the end it was necessary to temporarily set MAVEN_HOME via my build script. This solved the problem

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.