Blah, blah, blah
gmaven-archetype-mojo Archetype
To help get Groovy plugins started faster, you can use the gmaven-archetype-mojo. This will create a new project with the basic POM configuration and an example Groovy-based Mojo class to get you started quickly:
mvn archetype:generate -DarchetypeGroupId=org.codehaus.groovy.maven.archetypes -DarchetypeArtifactId=gmaven-archetype-mojo
|
To use a specific version of an archetype specify |
The Maven Archetype Plugin will ask a few questions about your new project:
... [INFO] Preparing archetype:generate [INFO] No goals needed for project - skipping ... [INFO] [archetype:generate] ... Define value for groupId: : org.mycompany.myproject Define value for artifactId: : example-maven-plugin Define value for version: : 1.0-SNAPSHOT Define value for package: : org.mycompany.myproject.example Confirm properties configuration: name: Example Maven Plugin groupId: org.mycompany.myproject artifactId: example-maven-plugin version: 1.0-SNAPSHOT package: org.mycompany.myproject.example Y: : y ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ ...
|
Please ignore any |
The above example would have created the following project structure:
example-maven-plugin example-maven-plugin/pom.xml example-maven-plugin/src example-maven-plugin/src/main example-maven-plugin/src/main/groovy example-maven-plugin/src/main/groovy/org example-maven-plugin/src/main/groovy/org/mycompany example-maven-plugin/src/main/groovy/org/mycompany/myproject example-maven-plugin/src/main/groovy/org/mycompany/myproject/example example-maven-plugin/src/main/groovy/org/mycompany/myproject/example/HelloMojo.groovy
To build the new project simply change to the newly created project directory and run Maven:
cd example-maven-plugin mvn install
The build output should look something like this:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Example Maven Plugin
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [groovy:generateStubs {execution: default}]
[INFO] Generated 1 Java stub
[INFO] [plugin:descriptor]
[INFO] Using 2 extractors.
[INFO] Applying extractor for language: java
[INFO] Extractor for language: java found 1 mojo descriptors.
[INFO] Applying extractor for language: bsh
[INFO] Extractor for language: bsh found 0 mojo descriptors.
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 1 source file to /Users/jason/ws/tmp/example-maven-plugin/target/classes
[INFO] [groovy:compile {execution: default}]
[INFO] Compiled 1 Groovy source file
[INFO] [groovy:generateTestStubs {execution: default}]
[INFO] No sources found for Java stub generation
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [groovy:testCompile {execution: default}]
[INFO] No sources found to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [jar:jar]
[INFO] Building jar: /Users/jason/ws/tmp/example-maven-plugin/target/example-maven-plugin-1.0-SNAPSHOT.jar
[INFO] [plugin:addPluginArtifactMetadata]
[INFO] [install:install]
[INFO] Installing /Users/jason/ws/tmp/example-maven-plugin/target/example-maven-plugin-1.0-SNAPSHOT.jar to /Users/jason/.m2/repository/org/mycompany/myproject/example-maven-plugin/1.0-SNAPSHOT/example-maven-plugin-1.0-SNAPSHOT.jar
[INFO] [plugin:updateRegistry]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10 seconds
[INFO] Finished at: Tue Apr 08 14:07:00 ICT 2008
[INFO] Final Memory: 15M/26M
[INFO] ------------------------------------------------------------------------
gmaven-plugin Packaging
TODO |
