I've learned a lot about Grails Plugins while trying to build a simple Grails App with MongoDB.
First stop was this blog post on MongoDB titled "Grails in the Land of MongoDB".
My blog post is based on this posting from MongoDB, with additional notes and information that I discovered while following these steps.
The blog post "Grails in the Land of MongoDB" listed steps as follows:
Step 1: Remove the hibernate dependency from the BuildConfig.groovy file.
This wasn't as straightforward as I thought. I am using Grails 2.1.0. After I ran the command:
grails create-app doctor
I opened up the BuildConfig.groovy file. It had the following plugins:
plugins { runtime ":hibernate:$grailsVersion" runtime ":jquery:1.7.2" runtime ":resources:1.1.6" // Uncomment these (or add new ones) to enable additional resources capabilities //runtime ":zipped-resources:1.0" //runtime ":cached-resources:1.0" //runtime ":yui-minify-resources:0.1.4" build ":tomcat:$grailsVersion" runtime ":database-migration:1.1" compile ':cache:1.0.0' }
I removed the entries for Hibernate and Database Migration.
After making these changes, my plugins section of BuildConfig.groovy appeared as follows:
plugins { runtime ":jquery:1.7.2" runtime ":resources:1.1.6" // Uncomment these (or add new ones) to enable additional resources capabilities //runtime ":zipped-resources:1.0" //runtime ":cached-resources:1.0" //runtime ":yui-minify-resources:0.1.4" build ":tomcat:$grailsVersion" compile ':cache:1.0.0' }
Step 2:Install the MongoDB GORM
I ran the command:
grails install-plugin mongodb
This did the following (as far as I can tell):
- Added an entry to my application.properties: plugins.mongodb=1.0.0.GA
- Created the directory projects/doctor/plugins/mongodb-1.0.0.GA in my .grails directory.
There was a slight typo in the MongoDB blog. The port should actually be 27017.
grails { mongo { host = "localhost" port = 27017 username = "doctorUser" password="medicine" databaseName = "doctors" } }
No comments:
Post a Comment