Upgrading a mavenized project to Grails 1.1

1. Download and extract Grails 1.1

Download from http://grails.org/Download

Extract the content to D:\dev\grails for example.

Make sure this is the correct version in your PATH :

D:\>grails
Welcome to Grails 1.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: D:\dev\grails

No script name specified. Use 'grails help' for more info or 'grails interactive
' to enter interactive mode

2. Upgrade your project

Run “grails upgrade” in your project folder.

D:\dev\projects\demo>grails upgrade
Welcome to Grails 1.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: D:\dev\grails

Base Directory: D:\dev\projects\demo
Running script D:\dev\grails\scripts\Upgrade.groovy
Environment set to development
NOTE: Your application currently expects grails version [1.1-RC1], this target w
ill upgrade it to Grails 1.1 ...

                WARNING: This target will upgrade an older Grails application to
1.1.
                However, tag libraries provided by earlier versions of Grails fo
und in grails-app/taglib will be removed.
                The target will not, however, delete tag libraries developed by
yourself.
                Are you sure you want to continue?
                                    (y, n)
y
   [delete] Deleting directory D:\dev\projects\demo\web-app\WEB-INF\classes
   [delete] Deleting directory C:\Documents and Settings\A\.grails\1.1\projects\
demo\resources
     [copy] Copying 1 resource to D:\dev\projects\demo\tmp-upgrade
    [unjar] Expanding: D:\dev\projects\demo\tmp-upgrade\grails-shared-files.jar
into D:\dev\projects\demo\tmp-upgrade
   [delete] Deleting: D:\dev\projects\demo\tmp-upgrade\grails-shared-files.jar
     [copy] Copying 8 files to D:\dev\projects\demo
   [delete] Deleting directory D:\dev\projects\demo\tmp-upgrade
     [move] Moving 1 file to D:\dev\projects\demo
     [move] Moving 1 file to D:\dev\projects\demo
     [move] Moving 1 file to D:\dev\projects\demo
     [copy] Copying 1 file to D:\dev\projects\demo\web-app\WEB-INF
     [copy] Copying 1 file to D:\dev\projects\demo\web-app\WEB-INF
     [copy] Copying 4 files to D:\dev\projects\demo\web-app\WEB-INF\tld
Installing plug-in hibernate-1.1
    [mkdir] Created dir: C:\Documents and Settings\A\.grails\1.1\projects\demo\p
lugins\hibernate-1.1
    [unzip] Expanding: C:\Documents and Settings\A\.grails\1.1\plugins\grails-hi
bernate-1.1.zip into C:\Documents and Settings\A\.grails\1.1\projects\demo\plugi
ns\hibernate-1.1
Executing hibernate-1.1 plugin post-install script ...
Plugin hibernate-1.1 installed
Please make sure you view the README for important information about changes to
your source code. ...
Project upgraded

 

3. Verify Maven compatibility

Modify your pom.xml, change “grails-maven-plugin” version to 1.0. (According to http://www.grails.org/Maven+Integration)

<build>
  <pluginManagement />
  <plugins>
    <plugin>
      <groupId>org.grails</groupId>
      <artifactId>grails-maven-plugin</artifactId>
      <version>1.0</version>
      <extensions>true</extensions>
      […]

Does it build now ? Yes !

D:\dev\projects\demo>mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.projects:demo:war:0.1
[INFO]    task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory D:\dev\projects\demo\target
[INFO] [grails:maven-clean {execution: default}]
Running pre-compiled script
Environment set to development
   [delete] Deleting directory D:\dev\projects\demo\target\resources
[INFO] [grails:validate {execution: default}]
[INFO] [grails:init {execution: default}]
[INFO] [grails:config-directories {execution: default}]
[INFO] [resources:resources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\dev\projects\demo\src\main\resourc
es
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [grails:maven-compile {execution: default}]
Running pre-compiled script
    [mkdir] Created dir: D:\dev\projects\demo\target\classes
  [groovyc] Compiling 6 source files to D:\dev\projects\demo\target\classes
[INFO] [resources:testResources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\dev\projects\demo\src\test\resourc
es
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [grails:maven-test {execution: default}]
Running pre-compiled script
    [mkdir] Created dir: D:\dev\projects\demo\test\reports
    [mkdir] Created dir: D:\dev\projects\demo\test\reports\html
    [mkdir] Created dir: D:\dev\projects\demo\test\reports\plain

Starting unit tests ...
Running tests of type 'unit'
    [mkdir] Created dir: D:\dev\projects\demo\target\test-classes\unit
No tests found in test/unit to execute ...

Starting integration tests ...
     [copy] Copying 1 file to D:\dev\projects\demo\target\test-classes\integrati
on
    [mkdir] Created dir: D:\dev\projects\demo\target\resources\grails-app\i18n
[native2ascii] Converting 11 files from D:\dev\projects\demo\grails-app\i18n to
D:\dev\projects\demo\target\resources\grails-app\i18n
     [copy] Copying 1 file to D:\dev\projects\demo\target\classes
     [copy] Copied 2 empty directories to 2 empty directories under D:\dev\proje
cts\demo\target\resources
Running tests of type 'integration'
No tests found in test/integration to execute ...
[junitreport] Processing D:\dev\projects\demo\test\reports\TESTS-TestSuites.xml
to C:\DOCUME~1\A\LOCALS~1\Temp\null892652039
[junitreport] Loading stylesheet jar:file:/C:/Documents%20and%20Settings/A/.m2/r
epository/org/apache/ant/ant-junit/1.7.1/ant-junit-1.7.1.jar!/org/apache/tools/a
nt/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 1281ms
[junitreport] Deleting: C:\DOCUME~1\A\LOCALS~1\Temp\null892652039

Tests PASSED - view reports in D:\dev\projects\demo\test\reports.
[INFO] [war:war]
[INFO] Packaging webapp
[INFO] Assembling webapp[demo] in [D:\dev\projects\demo\target\demo-0.1]
[INFO] Processing war project
[INFO] Copying webapp resources[D:\dev\projects\demo\src\main\webapp]
[INFO] Webapp assembled in[3297 msecs]
[INFO] Building war: D:\dev\projects\demo\target\demo-0.1.war
[INFO] [grails:maven-war {execution: default}]
Running pre-compiled script
Warning, target causing name overwriting of name startLogging
    [mkdir] Created dir: D:\dev\projects\demo\target\staging
     [copy] Copying 33 files to D:\dev\projects\demo\target\staging
     [copy] Copied 9 empty directories to 1 empty directory under D:\dev\project
s\demo\target\staging
     [copy] Copying 14 files to D:\dev\projects\demo\target\staging\WEB-INF\grai
ls-app
     [copy] Copying 28 files to D:\dev\projects\demo\target\staging\WEB-INF\clas
ses
    [mkdir] Created dir: D:\dev\projects\demo\target\staging\WEB-INF\spring
    [mkdir] Created dir: D:\dev\projects\demo\target\staging\WEB-INF\templates\s
caffolding
     [copy] Copying 39 files to D:\dev\projects\demo\target\staging\WEB-INF\lib
     [copy] Copying 1 file to D:\dev\projects\demo\target\staging\WEB-INF
   [delete] Deleting: D:\dev\projects\demo\target\resources\web.xml
     [copy] Copying 4 files to D:\dev\projects\demo\target\staging\WEB-INF\lib
[propertyfile] Updating property file: D:\dev\projects\demo\target\staging\WEB-I
NF\classes\application.properties
    [mkdir] Created dir: D:\dev\projects\demo\target\staging\WEB-INF\plugins\hib
ernate-1.1-RC1
     [copy] Copying 1 file to D:\dev\projects\demo\target\staging\WEB-INF\plugin
s\hibernate-1.1-RC1
      [jar] Building jar: D:\dev\projects\demo\demo-0.1.war
   [delete] Deleting directory D:\dev\projects\demo\target\staging
Done creating WAR D:\dev\projects\demo/demo-0.1.war
[INFO] Moved WAR file to 'D:\dev\projects\demo\target\demo-0.1.war'.
[INFO] [install:install]
[INFO] Installing D:\dev\projects\demo\target\demo-0.1.war to C:\Documents and S
ettings\A\.m2\repository\com\projects\demo\0.1\demo-0.1.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 4 seconds
[INFO] Finished at: Tue Mar 31 23:32:11 CEST 2009
[INFO] Final Memory: 63M/63M
[INFO] ------------------------------------------------------------------------

1 comments:

Sunil said...

Some one tell me maven integrated project can build a war in Document and setting folder(mainly in a build path which contains white space). It is not building for me.

Post a Comment