Last updated by admin 4 years ago
???? ????
???? ?? ????
??
?? ????,????? ??? ??? ??? ??? ?? ???? ???? Grails ??????? ?????. ??? ??? ??? ???? ???? ??? ?? ????. ?? ?? ?? ???? ???? ??? ?????:
+ grails-app
+ controllers
+ domain
+ taglib
etc.
+ lib
+ src
+ java
+ groovy
+ web-app
+ js
+ css??, ????? ???? ????? {{grails-app}} ????? ?? ??????? ?? ????? ???? ?? ??? {{$PROJECT_HOME/plugins/example-1.0/grails-app}}? ???? ???. ????? ?? ????? ?? ?? ??? ???? ????.
??? {{web-app}} ???? ?? ?? ???? ?? ??? ????? ????? {{web-app}} ???? ?? {{web-app/plugins/example-1.0/js}} ? ?? ??? ?? ????? ???? ?????. ??? ??? ????? ??? ???? ?? ????? ?????. ?? ?? GSP?? ?????? ??? ????? ??? ?? ?????:
<g:createLinkTo dir="/plugins/example/js" file="mycode.js" />
Java & Groovy code that the plugin provides within the {{lib}} and {{src/java}} and {{src/groovy}} directories will be compiled into the main project's web-app/WEB-INF/classes directory so that they are made available at runtime.
?????? ? ? ?? ?? ?? ?
A plugin can do just about anything, but a good plugin should be as unintrusive as possible. It should use convention over configuration where possible, otherwise provide an artifact in a project's grails-app/conf directory where configuration can be done.
One thing a plugin cannot do though is modify the web-app/WEB-INF/web.xml or web-app/WEB-INF/applicationContext.xml files. A plugin can participate in web.xml generation, but not modify the file or provide a replacement. A plugin can NEVER change the {{applicationContext.xml}} file, but can provide runtime bean definitions as seen shortly.