Search code examples
grailsgrails-plugin

Creating GroupID and ArtifactID for a custom Grails plugin


I am writing my own Grails Plugin. When I package it, I see a pom.xml and plugin.xml are generated. In these, the groupId and artifactId are org.grails.plugins and plugin-config respectively.

I would like to specify what these should be so hat my plugin ends up in the correct place in artifactory.

How do I do this?

Thanks.


Solution

  • It is the job of release plugin to set the default groupId for the plugin. For all grails plugin it is org.grails.plugins.

    You can modify groupId by setting a property in plugin descriptor as:

    class PluginDemoGrailsPLugin{
    
        //or def groupId = ...
        def group = "com.example.plugins"
        ......
    }
    

    The artifactId is chosen by convention as well. For example:

    Project Name --> ArtifactId    --> Artifact Name
    -----------------------------------------------------
    PluginDemo   --> plugin-demo   --> grails-plugin-demo.zip
    PluginConfig --> plugin-config --> grails-plugin-config.zip
    

    I have not seen the artifactId being customized without integrating with build tools like Maven or Gradle. Using these build tools it is transparent as to how groupId and artifactId can be specified.