Monday, February 15, 2010

Groovy 1.7.0 and GMaven 1.2 Multi Module Projects

Update GMaven 1.3 is out
The documentation on the GMaven wiki is a bit out of date and shows how to setup a GMaven 1.0 project. There have been a couple of (big) releases of both GMaven and Groovy since then and GMaven has become its own project on Codehaus as well as changed their groupId from org.codehaus.groovy.maven to org.codehaus.gmaven. There seem to be a few other items you may or may not need to configure that weren't needed previously as well.

Hopefully the documentation will be updated soon but here is a comparison of poms between GMaven 1.0 and 1.2 that I've been using.



GMaven 1.0 POM

GMaven 1.2 POM

11 comments:

  1. Hi,

    Your POM has a lot of typos. It's invalid. a couple of times the elements are not matching.

    pluginmanagement - pluginManagement
    groupid - groupId
    artifactid - artifactId
    dependencymanagement - dependencyManagement
    providerselection - providerSelection

    ReplyDelete
  2. @Marko

    Thanks, updated the code.

    I'll blame blogger until proven its my fault ;) (I actually did do a schema validation on it before posting it)

    ReplyDelete
  3. I'm trying the 1.2 version. I had to put the generateStubs goal before the compile goal or it didn't work.

    ReplyDelete
  4. One last, possibly irrelevant comment...

    I was having problems with my project in eclipse, because I had added Groovy nature to the project, so I was doubling the stub generation step. If its a gmaven project, it shouldn't also be a groovy project in eclipse.

    Otherwise I've got the 1.2 version working, that's a million Ben!

    ReplyDelete
  5. Hi
    When I trying to make "mvn install" I get an error listed below. In location where I try bulid the project I have only pom.xml 1.2 version. Could you help me with this?

    """
    $ mvn install
    ...// everything is going smooth until ...

    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Failed to resolve artifact.

    Missing:
    ----------
    1) commons-logging:commons-logging:jar:1.0.4

    Try downloading the file manually from the project website.

    Then, install it using the command:
    mvn install:install-file -DgroupId=commons-logging -DartifactId=commons-logging -Dversion=1.0.4 -Dpackaging=jar -Dfile=/path/to/file

    Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=commons-logging -DartifactId=commons-logging -Dversion=1.0.4 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

    Path to dependency:
    1) org.codehaus.gmaven:gmaven-plugin:maven-plugin:1.2
    2) org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4.1
    3) commons-validator:commons-validator:jar:1.2.0
    4) commons-logging:commons-logging:jar:1.0.4

    2) commons-collections:commons-collections:jar:3.2

    Try downloading the file manually from the project website.

    Then, install it using the command:
    mvn install:install-file -DgroupId=commons-collections -DartifactId=commons-collections -Dversion=3.2 -Dpackaging=jar -Dfile=/path/to/file

    Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=commons-collections -DartifactId=commons-collections -Dversion=3.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

    Path to dependency:
    1) org.codehaus.gmaven:gmaven-plugin:maven-plugin:1.2
    2) org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4.1
    3) org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-10
    4) commons-collections:commons-collections:jar:3.2

    .... // and more jars



    [INFO] ------------------------------------------------------------------------
    [INFO] For more information, run Maven with the -e switch
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 56 seconds
    [INFO] Finished at: Tue Mar 09 16:26:37 CET 2010
    [INFO] Final Memory: 9M/17M

    """

    K

    ReplyDelete
  6. CSS gone wild: I cannot view your POM XML in either FF 3.6.2 or IE8. The code is there, however, if you view source.

    ReplyDelete
  7. @Anonymous
    It looks like some of your plugins are using different versions of commons logging. Try running mvn dependency:tree -Dverbose -Dincludes=commons-logging

    ReplyDelete
  8. @kenwdelong the source viewer requires javascript enabled.

    ReplyDelete
  9. Thanks this was useful.

    Latest info on GMaven is almost invisible but I could see from central that version 1.3 is out and supports Groovy 1.7 so this greatly simplifies the pom necessary now because the plugin's dep on groovy does not need to be overridden.

    ReplyDelete
  10. @Chris Thats good news, it was a bit odd having to declare the dependency for both the project and the plugin. I'll update the post with that info.

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete