Last updated by admin 4 years ago
??????????????????{excerpt:hidden=true}Creating, Distributing & Installing{excerpt}
????????{excerpt:hidden=true}Creating a Plugin{excerpt}
???????????????Grails?????????????????:{excerpt:hidden=true} You can create a Grails plugin by running the command:{excerpt}grails create-plugin [PLUGIN NAME]
code: nullclass ExampleGrailsPlugin { def version = 0.1 … }code: null??????????????????????????????????????????????????????????????????????????????????(???????)?????????????????????????????{excerpt:hidden=true} All plugins must have this class in the root of their directory structure to be valid. The plugin class defines the version of the plugin and optionally various hooks into plugin extension points (covered shortly).{excerpt} ???????????????????????Grails????????????????????????Grails??????????????????????????? {{grails run-app}} ??????Grails??????????????????{excerpt:hidden=true} In fact, not only is the structure the same, but a plugin is a Grails application so you can just type {{grails run-app}} from the root of the plugin directory to execute a Grails plugin as a Grails app. {excerpt}???????????????{excerpt:hidden=true}Installing & Distributing Plugins{excerpt}
{{example}} ????????????? {{cd example}} ??????????????????????????????????:{excerpt:hidden=true} To distribute the {{example}} plugin you need to navigate to its root directory using {{cd example}} and then type:{excerpt}code: nullgrails package-plugincode: null???????"grails"??????????????????????zip????????????????????? {{grails-example-0.1.zip}} ?????????????{excerpt:hidden=true} This will create a zip file of the plugin starting with "grails" then the plugin name and version. For example in the above case this would be {{grails-example-0.1.zip}}.{excerpt} ?????????????????????????Grails?????????????????:{excerpt:hidden=true} Once you have a plugin distribution file you can navigate to a Grails project and type:{excerpt}????????????HTTP????????????????????????:{excerpt:hidden=true} If the plugin was hosted on a remote HTTP server you can also do:{excerpt}grails install-plugin /path/to/plugin/grails-example-0.1.zip???Grails????????http://dist.codehaus.org/grails/plugins??????????????????????:{excerpt:hidden=true} Also for Grails plugins that are distributed at http://dist.codehaus.org/grails/plugins you can do:{excerpt}grails install-plugin http://myserver.com/plugins/grails-example-0.1.zipgrails install-plugin example 0.1



