Forums/Go Community & Support/Getting Started

Using Maven with Go

Mansi Shah
posted this on May 04, 2011 11:44

You can use maven and Go together by using the "exec" builder of cruise.

Please do the following to set up maven with Go:

1. Create a batch file(If you are on windows, else, .sh file) with the maven command you want to run through Go. 
2. While setting up the pipeline, choose "exec" as your builder and give the batch file name (created in step 1) and the parameters, if any.

Go recognizes build tools like ant, rake and nant; any other build tool can be integrated with cruise using the "exec" builder where you call the build commands through a batch file.

 

Comments

User photo
Kbreidenbach

Any chance that Go will catch up with Jenkins/Hudson and be able to run Gradle or Maven builds?

March 19, 2012 21:20
User photo
Sriram Narayan
ThoughtWorks Studios

Using Maven with Go

Here is a fairly detailed guide to using maven with Go. It works for maven2 or maven3. Just ensure that the correct maven bin directory is the path for both Go server and agent. On Windows this will be the user path or system path depending on whether you have configured a path for the user Go runs as. Maven repository will will default to $GO_USER_HOME/.m2 unless you have configured it differently. Note that the default repository setting with mean that each remote Go agent initialises its own repo from the internet.

A simple project

We adapt a simple maven project available at
http://maven.apache.org/maven-1.x/start/samples/sample-echo.zip
We modify the pom to be:

Pipeline with one stage and job

Refer Go docs to set up your material definition. Once that is done, define your job as below:

Maven is configured as a custom command as below. Note that we set working directory relative to material root and by default, maven will look for a pom.xml under working directory.

Junit tests

Next, we specify the location of junit reports so that Go can display a test summary.

Overall config

At the end of this config, the pipeline config xml looks like

Maven 2 and 3

That’s it. Trigger the pipeline and wait for it to finish. With maven2 in the path, the console output looks like:


and with maven3, we get

Go summarises the tests like below:

and this is what you get under artifacts.

May 17, 2012 12:01
User photo
Sriram Narayan
ThoughtWorks Studios

oops. It looks like Zendesk pushed down some of the text that was intended to appear above the respective images.

May 17, 2012 12:10