- Installed Eclipse jee 3.5 Galileo SR1 (download)
- Installed SVN plugin Subclipse (Update site: http://subclipse.tigris.org/update_1.6.x)
- Installed Groovy plugin (Update site: http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.5/)
- Installed Ivy plugin (http://www.apache.org/dist/ant/ivyde/updatesite)
Finally I create the GRAILS_HOME variable in Eclipse->Preferences->Java->Build Path->Classpath Variables. This is used by Eclipse to compile the project. You may notice that GROOVY_HOME and IVY_HOME have already been created by the plugins.
Now I want to create a new Grails application that I will call 'FirstApp'. For doing this I will use the command line and, after positioning myself in the root of the current workspace, I type:
> grails create-app FirstApp
This will create the structure of my new application (in the newly created directory: FirstApp). I can now import this structure as 'Import as Existing Project' in my workspace. I can enable the Groovy capabilities right clicking on the project and selecting: Configure-> Convert to Groovy project.
Now if you right-click on the project and select: Properties->Java Build Path you will notice tha all the libraries are linked in a subdirectory of GRAILS_HOME. This is not my solution as I want to be dependent from the ivy.xml file. To do so, I select the ivy.xml file, I right-clik and select 'Add Ivy Library...'. This will link, through ivy, all the libraries necessary to the newly created Grails application to compile and run. Once performed this step I can safely remove all the libraries linked in the subdirectory GRAILS_HOME from the Properties->Java Build Path. You should also notice a new icon in the toolbar with tooltip 'Resolve All Dependencies'. You can use that icon to retrieve new dependencies that you specified in the ivy.xml file.
Now I can test if the application is actually running. I select a file in the project and I run the external application 'Grails' that I previously created. A window will pop up and we can fill out the text box with the command 'run-app'. The alternative would have been to use the shall and, after positioning in the root of the project, type:
> grails run-app
If everything went right we can now browse: http://localhost:8080/FirstApp/ getting back the Grails welcome screen.
No comments:
Post a Comment