开发者

What's the best practice java package to put a Grails plugin's Groovy classes in?

开发者 https://www.devze.com 2023-02-28 03:44 出处:网络
I\'m building a Grails plugin.I have a few Groovy classes in $pluginDir/src/groovy.Grails apps that use this plugin will be instantiating these classes, so the class name and package name matter.

I'm building a Grails plugin. I have a few Groovy classes in $pluginDir/src/groovy. Grails apps that use this plugin will be instantiating these classes, so the class name and package name matter.

Is there a best practice as to what java package to put these classes into? I don't want to put th开发者_如何学Goem into the default namespace; the classes names are fairly generic and could easily collide with other classes.

I'm hoping it's something like org.grails.plugin.myPluginName, but I haven't found any documentation.

Thanks!


grails.plugin.xxx is an unofficial but recommended standard decided by the community

Reference

http://grails.1312388.n4.nabble.com/Package-name-for-plugins-td4644160.html http://grails.1312388.n4.nabble.com/Plugin-namespaces-td2294738.html


I've seen a few of different package structures.

grails.plugin.myPluginName
org.codehaus.groovy.grails.plugins.myPluginName

The latter generally for plugins written by someone on the SpringSource team, like the spring-security-core plugin. The former is for Greenmail. If I were you, I'd look at several existing plugins, and pick the one that feels right for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号