grails-core
grails-core copied to clipboard
Package Grails plugin generate grails-plugin.xml with wrong version and dependOn nodes
Expected Behavior
The expected result is:
<plugin name='grailsPluginDependOnIssue' version='5.1.7' grailsVersion='5.1.7 > *'>
<type>org.grails.demos.GrailsPluginDependOnIssueGrailsPlugin</type>
<grailsVersion>5.1.7 > *</grailsVersion>
<authorEmail></authorEmail>
<pluginExcludes>[grails-app/views/error.gsp]</pluginExcludes>
<dependsOn core='5.1.7' domainClass='5.1.7' services='5.1.7' />
<author>Your name</author>
<documentation>http://grails.org/plugin/grails-plugin-depend-on-issue</documentation>
<profiles>[web]</profiles>
<name>grails-plugin-depend-on-issue</name>
<description>Brief summary/description of the plugin.
</description>
<title>Grails Plugin Depend On Issue</title>
<version>5.1.7</version>
<resources>
<resource>org.grails.demos.UrlMappings</resource>
<resource>org.grails.demos.Application</resource>
<resource>org.grails.demos.BootStrap</resource>
</resources>
</plugin>
Actual Behaviour
<plugin name='grailsPluginDependOnIssue' version='0.1' grailsVersion='5.1.7 > *'>
<type>org.grails.demos.GrailsPluginDependOnIssueGrailsPlugin</type>
<grailsVersion>5.1.7 > *</grailsVersion>
<authorEmail></authorEmail>
<pluginExcludes>[grails-app/views/error.gsp]</pluginExcludes>
<dependsOn core='version' domainClass='version' services='version' />
<author>Your name</author>
<documentation>http://grails.org/plugin/grails-plugin-depend-on-issue</documentation>
<profiles>[web]</profiles>
<name>grails-plugin-depend-on-issue</name>
<description>Brief summary/description of the plugin.
</description>
<title>Grails Plugin Depend On Issue</title>
<version />
<resources>
<resource>org.grails.demos.UrlMappings</resource>
<resource>org.grails.demos.Application</resource>
<resource>org.grails.demos.BootStrap</resource>
</resources>
</plugin>
Steps To Reproduce
Create new Grails Plugin
sdk use grails 5.1.7
grails create-plugin org.grails.demos.grails-plugin-depend-on-issue
Package the Grails Plugin
I update the GrailsPluginDependOnIssueGrailsPlugin.groovy, add two properties: version and dependsOn.
src/main/groovy/org/grails/demos/GrailsPluginDependOnIssueGrailsPlugin.groovy
class GrailsPluginDependOnIssueGrailsPlugin extends Plugin {
def version = GrailsUtil.getGrailsVersion()
def dependsOn = [core: version, domainClass: version, services: version]
}
Then I run this command to package the plugin, this task also generate grails-plugin.xml for it, but the version and dependsOn nodes were not right as expected.
./gradlew build
build/classes/groovy/main/META-INF/grails-plugin.xml
<plugin name='grailsPluginDependOnIssue' version='0.1' grailsVersion='5.1.7 > *'>
<type>org.grails.demos.GrailsPluginDependOnIssueGrailsPlugin</type>
<grailsVersion>5.1.7 > *</grailsVersion>
<authorEmail></authorEmail>
<pluginExcludes>[grails-app/views/error.gsp]</pluginExcludes>
<dependsOn core='version' domainClass='version' services='version' />
<author>Your name</author>
<documentation>http://grails.org/plugin/grails-plugin-depend-on-issue</documentation>
<profiles>[web]</profiles>
<name>grails-plugin-depend-on-issue</name>
<description>Brief summary/description of the plugin.
</description>
<title>Grails Plugin Depend On Issue</title>
<version />
<resources>
<resource>org.grails.demos.UrlMappings</resource>
<resource>org.grails.demos.Application</resource>
<resource>org.grails.demos.BootStrap</resource>
</resources>
</plugin>
Environment Information
MacOS 11.6.5 M1 Grails Version: 5.1.7 JVM Version: 11.0.14
Example Application
https://github.com/rainboyan/grails-plugin-depend-on-issue
Version
5.1.7