Integrating Grails and Maven

0
934

I’ve started investigating Grails for some projects and have been making some good headway and I like to use Maven for everything as it’s amazing, and generating projects is easy.


Chill:stsworkspace idimmu$ mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate -DarchetypeGroupId=org.grails -DarchetypeArtifactId=grails-maven-archetype -DarchetypeVersion=1.2.0 -DgroupId=idimmu.net -DartifactId=superted
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [archetype:generate]
[INFO] Generating project in Interactive mode
[WARNING] No archetype repository found. Falling back to central repository (http://repo1.maven.org/maven2).
[WARNING] Use -DarchetypeRepository= if archetype's repository is elsewhere.
Define value for version: 1.0-SNAPSHOT: :
Confirm properties configuration:
groupId: idimmu.net
artifactId: superted
version: 1.0-SNAPSHOT
package: idimmu.net
Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating OldArchetype: grails-maven-archetype:1.2.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: idimmu.net
[INFO] Parameter: packageName, Value: idimmu.net
[INFO] Parameter: package, Value: idimmu.net
[INFO] Parameter: artifactId, Value: superted
[INFO] Parameter: basedir, Value: /Users/idimmu/Documents/stsworkspace
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/pom.xml [line 147,column 20] : ${java.version} is not a valid reference.
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/pom.xml [line 149,column 23] : ${java.home} is not a valid reference.
[INFO] ********************* End of debug info from resources from generated POM ***********************
[INFO] OldArchetype created in dir: /Users/idimmu/Documents/stsworkspace/superted
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15 seconds
[INFO] Finished at: Thu Jan 07 21:45:39 GMT 2010
[INFO] Final Memory: 12M/79M
[INFO] ------------------------------------------------------------------------

Then of course we initialise the project


Chill:superted idimmu$ mvn initialize
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - idimmu.net:gymlife:war:1.0-SNAPSHOT
[INFO] task-segment: [initialize]
[INFO] ------------------------------------------------------------------------
[INFO] [grails:validate {execution: default}]
[INFO] No Grails application found - skipping validation.
[INFO] [grails:init {execution: default}]
[INFO] Cannot read application info, so initialising new application.
[INFO] Using Grails 1.2.0
Running pre-compiled script
Environment set to development
Warning, target causing name overwriting of name default
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/src/java
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/src/groovy
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app/controllers
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app/services
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app/domain
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app/taglib
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app/utils
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app/views
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app/views/layouts
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app/i18n
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app/conf
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/test
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/test/unit
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/test/integration
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/scripts
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/web-app
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/web-app/js
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/web-app/css
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/web-app/images
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/web-app/META-INF
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/lib
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app/conf/spring
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app/conf/hibernate
[propertyfile] Creating new property file: /Users/idimmu/Documents/stsworkspace/gymlife/application.properties
[copy] Copying 1 resource to /Users/idimmu/Documents/stsworkspace/gymlife
[unjar] Expanding: /Users/idimmu/Documents/stsworkspace/gymlife/grails-shared-files.jar into /Users/idimmu/Documents/stsworkspace/gymlife
[delete] Deleting: /Users/idimmu/Documents/stsworkspace/gymlife/grails-shared-files.jar
[copy] Copying 1 resource to /Users/idimmu/Documents/stsworkspace/gymlife
[unjar] Expanding: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app-files.jar into /Users/idimmu/Documents/stsworkspace/gymlife
[delete] Deleting: /Users/idimmu/Documents/stsworkspace/gymlife/grails-app-files.jar
[copy] Copying 1 resource to /Users/idimmu/Documents/stsworkspace/gymlife/target/integration-files
[unjar] Expanding: /Users/idimmu/Documents/stsworkspace/gymlife/target/integration-files/grails-integration-files.jar into /Users/idimmu/Documents/stsworkspace/gymlife/target/integration-files
[delete] Deleting: /Users/idimmu/Documents/stsworkspace/gymlife/target/integration-files/grails-integration-files.jar
[copy] Copying 3 files to /Users/idimmu/Documents/stsworkspace/gymlife
Created Eclipse project files.
Installing plugin hibernate-1.2.0
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/plugins/hibernate-1.2.0
[unzip] Expanding: /Users/idimmu/.grails/1.2.0/plugins/grails-hibernate-1.2.0.zip into /Users/idimmu/Documents/stsworkspace/gymlife/plugins/hibernate-1.2.0
Resolving plugin JAR dependencies
Executing hibernate-1.2.0 plugin post-install script ...
Plugin hibernate-1.2.0 installed
Installing plugin tomcat-1.2.0
[mkdir] Created dir: /Users/idimmu/Documents/stsworkspace/gymlife/plugins/tomcat-1.2.0
[unzip] Expanding: /Users/idimmu/.grails/1.2.0/plugins/grails-tomcat-1.2.0.zip into /Users/idimmu/Documents/stsworkspace/gymlife/plugins/tomcat-1.2.0
Executing tomcat-1.2.0 plugin post-install script ...
Plugin tomcat-1.2.0 installed
Plug-in provides the following new scripts:
------------------------------------------
grails tomcat
Found events script in plugin tomcat
Created Grails Application at /Users/idimmu/Documents/stsworkspace/superted
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16 seconds
[INFO] Finished at: Thu Jan 07 21:46:24 GMT 2010
[INFO] Final Memory: 48M/81M
[INFO] ------------------------------------------------------------------------