Pregunta

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.

¿Fue útil?

Solución

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.

Otros consejos

You can define the groupId and version in the *PluginConfig file like:

class PlayGrailsPlugin {
    def groupId = "com.example.project"
    def version = "1.0-SNAPSHOT"

    ...
}

How you name the plugin config file has a BIG impact.

The 'artifactId' is taken from the plugin name.
For example if you have a plugin called PlayGrailsPlugin the artifactId will be "play".
If your plugin does not specify a groupId then this defaults to "org.grails.plugins".

Specifying def artifactId = "play" in your file does not matter.

More detail can be found here

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top