Using Maven with Go

Follow

Comments

6 comments

  • Avatar
    Kbreidenbach

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

  • Avatar
    Sriram Narayan

    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.

  • Avatar
    Sriram Narayan

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

  • Avatar
    Marco Abis

    Kbreidenbach,

           there is no reason why you cannot used Gradle or Maven builds with Go today. In Mavens case it requires a bit more work because of the way Maven works, you can find out an example in this guest post Continuous Delivery with Maven and Go into Maven Central

    Marco 

  • Avatar
    Ryan McDonough

    The comments here kind of miss the mark in terms of Maven support. For starters, many projects have moved on to Maven, Gradle, or Ivy for some time now and Go still bases it's build around Ant. This looks more attractive that SonarQube, but Sonar's integration with Maven is super easy compared to the steps that have been detailed here. I should also point out the example you've highlight is for a Maven 1.0 project, which is radially different the Maven 2 & 3. 

    Go seems like a really interesting project but the continued lack of Maven support is a show stopper for most. 

  • Avatar
    Jyoti Singh

    Hi Ryan,

    >> lack of Maven support is a show stopper for most. 

    What level of maven support are you looking for? As pointed out by the others, you can run any maven command using the custom commands in Go. In fact, Go uses maven for dependency management,  you could have a look at the build pipelines of Go on https://build.go.cd using the login details specified here.

    Go also exposes a Task plugin extension, using which you can implement a task executor and a task configuration UI for Maven builds if required. You can find relevant documentations for writing a plugin here.

    Were you looking for something more?

    We might be able to help if you can elaborate a bit on the kind of out of the box support are you seeking for.

    Also, please note, the Go community pages have moved to mailing lists. You can find the links on go.cd . There are more people there to help.

    Cheers,

    Jyoti

Article is closed for comments.