Grails 3 war - 内联插件问题

Grails 3 war -Inline plugin issues

我正在尝试 war 带有内联插件的 grails 3.1.9 应用程序,它抛出一个错误 "java.lang.IllegalStateException: Unable to rename 'C:\test\grails_demo\plugins\grails_demo_plugin\build\libs\grails_demo_plugin-0.1.jar' to 'C:\test\grails_demo\plugins\grails_demo_plugin\build\libs\grails_demo_plugin-0.1.jar.original'"。

我不确定为什么不能重命名文件。我的 settings.gradle 文件包含:

include 'grails_demo_plugin'
project(":grails_demo_plugin").projectDir =  new File("plugins/grails_demo_plugin")

并且在 build.gradle 文件依赖块中包含如下所示:

dependencies {
    compile project(":grails_demo_plugin")
    compile "org.springframework.boot:spring-boot-starter-logging"
    compile "org.springframework.boot:spring-boot-autoconfigure"
    compile "org.grails:grails-core"
    compile "org.springframework.boot:spring-boot-starter-actuator"
    compile "org.springframework.boot:spring-boot-starter-tomcat"
    compile "org.grails:grails-dependencies"
    compile "org.grails:grails-web-boot"
    compile "org.grails.plugins:cache"
    compile "org.grails.plugins:scaffolding"
    compile "org.grails.plugins:hibernate4"
    compile "org.hibernate:hibernate-ehcache"
    console "org.grails:grails-console"
    profile "org.grails.profiles:web"
    runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.8.2"
    runtime "com.h2database:h2"
    testCompile "org.grails:grails-plugin-testing"
    testCompile "org.grails.plugins:geb"
    testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
    testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
}

当我尝试 运行 应用程序时,一切正常,但是当我使用 grails war 时,出现此错误。

几个小时后 google 我发现,错误来自 Gradle-Spring-Boot task bootRepackage .

根据这个 link(https://github.com/spring-projects/spring-boot/issues/1113) 我刚刚将 "bootRepackage { classifier = 'exec' }" 添加到我的插件的 build.gradle 文件中,错误消失了但是没有添加插件 jar到 war 文件。

这是我申请的 github link(https://github.com/Vigneshwaran082/grails_demo)

这是我完整的堆栈跟踪 link (https://github.com/Vigneshwaran082/grails_demo/blob/Vigneshwaran082-stackTrace/stackTrace.txtenter link description here)

我正在回答我自己的问题,以便将来对某人有用。

只需禁用 bootRepackage 任务即可解决此问题。只需将 "bootRepackage.enabled = false" 添加到插件目录内的所有 build.gradle 即可解决此问题。