[英]Grails 4 and Views-Json 2 : Build fails
I'm trying to upgrade a Grails app from 3.3 to 4 (specifically 4.0.3 for now) and the Views-Json 2.0.2 plugin.我正在尝试将 Grails 应用程序从 3.3 升级到 4(目前特别是 4.0.3)和 Views-Json 2.0.2 插件。 Profile is angular.
轮廓是有角度的。
When I run the app in development mode everything works.当我在开发模式下运行应用程序时,一切正常。 However when I attempt to build using
gradlew :server-api:assemble
the build fails at the Task :server-api:compileGsonViews (yeah, renamed 'server' to 'server-api' for clarity).但是,当我尝试使用
gradlew :server-api:assemble
构建时,构建在任务 :server-api:compileGsonViews 失败(是的,为了清楚起见,将“server”重命名为“server-api”)。
It looks like it's not finding my Java classes (there are a few under src/main/java
).看起来它没有找到我的 Java 类(在
src/main/java
下有一些)。
I've see refs to setting the classpath for the compileGsonViews, but I was undable to make it work.我已经看到了为 compileGsonViews 设置类路径的参考,但我无法让它工作。
Anyone with suggestions?有人有建议吗?
Running on Windows 10 with latest OpenJDK 1.8.x在带有最新 OpenJDK 1.8.x 的 Windows 10 上运行
Somehow I seem to have stumbled on the solution.不知何故,我似乎偶然发现了解决方案。 In my build.gradle I had enabled the grails pathingJar, commenting that out allowed my war to build.
在我的 build.gradle 中,我启用了 grails pathingJar,注释掉允许我的战争构建。 However with the property commented out, I was unable to use the
gradlew bootRun
command as it failed due to the path being too long.但是,在注释掉该属性后,我无法使用
gradlew bootRun
命令,因为它由于路径太长而失败。
The solution (for me) was to add a build property, the build file then looks like:解决方案(对我来说)是添加一个构建属性,构建文件看起来像:
def usePathing = Boolean.valueOf( System.getProperty('pathingJar', 'false') )
if (usePathing) {
grails {
pathingJar = true
}
}
If I was better with gradle I think I could (maybe) determine the goal that is being targeted and use that, but the above works.如果我对 gradle 更好,我想我可以(也许)确定目标并使用它,但上述方法有效。 The commend to assemble the war is the same;
集结战争的赞许是一样的; but to run the app directly I need to make it
gradlew server-api:bootRun -DpathingJar=true
但要直接运行该应用程序,我需要使其成为
gradlew server-api:bootRun -DpathingJar=true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.