Using grails to develop Google App engine apps

Source: Internet
Author: User
Tags grails

Objective

Grails, as the new force of the WEB framework, has been accepted by more and more developers. and Google App Engine (GAE) as a cloud computing platform for Applications to provide a broad space for expansion. How to make the two brilliant sparks?

With the help of the Gae-enabled plug-in--grails App Engine (the Gae plugin) in Grails, this article uses the JPA interface to take a ToDo application as an example of how to use the Gae plug-in for the development of GAE programs and considerations for development.

The environment used in this article:

Grails 1.3 M1

Google App Engine 1.3.1

app-engine-0.8.10

gorm-jpa-0.7.1

Environment construction

Please download the GAE SDK for Java and Grails first. Unzip the downloaded zip to the appropriate location and set the environment variables Appengine_home and grails_home.

Use the Grails Create-app AppName to create a grails project.

Install the GAE plugin in your project: Grails install-plugin app-engine, Data persistence selection JPA. This command will perform the following tasks:

Uninstall the Hibernate,tomcat plug-in; Install the GORM-JPA plugin.

Install the GORM-JPA plug-in.

Create under AppName \grails-app\conf:

Datastore-indexes.xml: The related configuration of the data store index, by default, the index is automatically created

Persistence.xml: Persistent Configuration

Create the artifacts, scaffolding, and war three directories under AppName \src\templates, which have domain class, controller/views, and web.xml template files respectively.

Create Userhome\.grails\1.3.0.m1\projects\appname\plugins\gorm-jpa-0.7.1\src \groovy\org\grails\jpa\ Jpapluginsupport.groovy, which is the most critical class of Plug, encapsulates JPA-related operations, and the methods invoked in Controller are passed through this class.

Once the environment is ready, performing grails App-engine run creates the following:

Copy the required Jar of GAE to AppName \ web-app \ web-inf\lib directory;

Create plugin directories, Grails.xml, Applicationcontext.xml, web.xml under AppName \ Web-app \ Web-inf

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.