------ Guide to Developing with Maven 2 and Groovy ------ Jason Dillon ------ $Id$ ------ ~~ ~~ Copyright (C) 2006-2007 the original author or authors. ~~ ~~ Licensed under the Apache License, Version 2.0 (the "License"); ~~ you may not use this file except in compliance with the License. ~~ You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, software ~~ distributed under the License is distributed on an "AS IS" BASIS, ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~~ See the License for the specific language governing permissions and ~~ limitations under the License. ~~ Guide to Developing with Maven 2 and Groovy * Introduction This guide is intended to assist users in developing Maven 2 modules (or projects) using {{{http://groovy.codehaus.org}Groovy}}. ** Conventions In this guide, we'll use the standard Maven directory structure for projects, to keep our POMs as simple as possible. It's important to note that this is only a standard layout, not a requirement. The important locations for our discussion are the following: +----+ / | +- pom.xml | +- src/ | | | +- main/ | | | | | +- groovy/ (source location for Groovy and optional Java sources) | | | | +- test/ | | | | | +- groovy/ (source location for Groovy and optional Java test sources) | | | ... +----+ ** Building the Module Now that you have your Mojos implemented in Groovy, we need to build the plugin. *** Project Definition Below is a POM for the simple sample groovy module pom: +----+ 4.0.0 com.mycompany myexample groovy-jar 1.0-SNAPSHOT My example Groovy module org.codehaus.mojo.groovy.runtime groovy-runtime-1.1 org.codehaus.mojo.groovy groovy-maven-plugin true +----+ Once you have your pom setup then you can build the module in the normal way via: +----+ mvn install +----+ * Groovy Maven Archetype To help get Groovy modules started faster, you can use the <<>>. This will create a new project with the basic POM configuration and an example joint Java + Groovy class structure to get you started quickly: +----+ mvn archetype:create -DarchetypeGroupId=org.codehaus.mojo.groovy -DarchetypeArtifactId=groovy-maven-archetype +----+ * Resources ** Groovy Development [[1]] {{{http://groovy.codehaus.org/Using+Ant+from+Groovy}Using Ant from Groovy}} [[2]] {{{http://ant.apache.org/manual/index.html}Ant User Manual}} [[3]] {{{http://groovy.codehaus.org/groovy-jdk.html}Groovy JDK Methods}} [[4]] {{{http://groovy.codehaus.org/api/index.html}Groovy Javadocs}}