compileAssets无法升级Grails应用程序 [英] compileAssets failing on upgrading Grails application

查看:84
本文介绍了compileAssets无法升级Grails应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行版本3.3的Grails应用程序.我最近升级到版本4.0.3.我通常认为升级的方法(不是我所知的最好方法)是将环境升级到新的Grails版本,然后创建一个全新的Grails项目(我正在使用IntelliJ),然后将文件从从旧项目到新项目,修复了我发现它们不起作用的问题.我已经将所有内容移到了一边,并且在IntelliJ中运行run-app时,该应用程序运行完美.但是,如果我去航站楼进行格斗战争",则会遇到编译资产的各种问题.我通常不会非常注意资产的处理方式(这只是个人应用程序).我在build.gradle文件中看到它正在使用资产管道插件版本3.0.10(com.bertramlabs.plugins:asset-pipeline-gradle:3.0.10).如果我将这些引用更改回Grails 3应用程序(2.14.2)中使用的assetPipeline版本,则错误消失了.有人知道这些版本是否存在差异,可能会导致我的问题?

I have a Grails application running version 3.3. I recently upgraded to version 4.0.3. The way I typically upgrade, which I understand is probably not the best way, is to upgrade my environment to the new Grails version, then create a brand new Grails project (I'm using IntelliJ), and then slowly move my files over from the old project to the new project, fixing things as I find they don't work. I have everything moved over and the app works perfectly while running run-app inside IntelliJ. However, if I go to the terminal and run "grails war" I get all kinds of issues compiling assets. I don't typically pay much attention to how assets are handled (this is just a personal application). I see that in my build.gradle file it's using asset pipeline plugin version 3.0.10 (com.bertramlabs.plugins:asset-pipeline-gradle:3.0.10). If I change these references back to the assetPipeline version that was being used in my Grails 3 app (2.14.2), then the errors go away. Does anyone know if there is a difference in these versions that could be causing my issue?

这是错误堆栈的很大一部分:

Here's a big chunk of the error stack:

...
Processing File 138 of 140 - redmond/images/ui-icons_cd0a0a_256x240.png
Processing File 139 of 140 - redmond/images/ui-icons_d8e7f3_256x240.png
Processing File 140 of 140 - redmond/images/ui-icons_f9bd01_256x240.png
> Task :Wolf:assetCompile FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.1/userguide/command_line_interface.html#sec:command_line_warnings
1 actionable task: 1 executed
<-------------> 0% WAITING
> Deleting unused version-specific caches in E:\java_dev\projects\Wolf4\.gradle
effects.unminified.js:720: ERROR - Object literal contains illegal duplicate key "scaleMode", disallowed in strict mode
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    ^^^^^^^^^

Closure uglify JS Exception
asset.pipeline.processors.MinifyException: [Lcom.google.javascript.jscomp.JSError;@3ad6a23
        at asset.pipeline.processors.ClosureCompilerProcessor.process(ClosureCompilerProcessor.groovy:80)
        at asset.pipeline.processors.ClosureCompilerProcessor$process$0.call(Unknown Source)
        at asset.pipeline.AssetCompiler$_compile_closure4.doCall(AssetCompiler.groovy:173)
        at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
        at groovy.lang.Closure.call(Closure.java:405)
        at groovy.lang.Closure.call(Closure.java:399)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
rico.unminified.js:163: ERROR - Object literal contains illegal duplicate key "hoverTextColor", disallowed in strict mode
         hoverTextColor      : '#ffffff',
         ^^^^^^^^^^^^^^

Closure uglify JS Exception
asset.pipeline.processors.MinifyException: [Lcom.google.javascript.jscomp.JSError;@7bb4d5d3
        at asset.pipeline.processors.ClosureCompilerProcessor.process(ClosureCompilerProcessor.groovy:80)
        at asset.pipeline.processors.ClosureCompilerProcessor$process$0.call(Unknown Source)
        at asset.pipeline.AssetCompiler$_compile_closure4.doCall(AssetCompiler.groovy:173)
        at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
        at groovy.lang.Closure.call(Closure.java:405)
        at groovy.lang.Closure.call(Closure.java:399)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
unittest.unminified.js:457: ERROR - Object literal contains illegal duplicate key "benchmark", disallowed in strict mode
  benchmark: function(operation, iterations) {
  ^^^^^^^^^

Closure uglify JS Exception
asset.pipeline.processors.MinifyException: [Lcom.google.javascript.jscomp.JSError;@3e732fc9
        at asset.pipeline.processors.ClosureCompilerProcessor.process(ClosureCompilerProcessor.groovy:80)
        at asset.pipeline.processors.ClosureCompilerProcessor$process$0.call(Unknown Source)
        at asset.pipeline.AssetCompiler$_compile_closure4.doCall(AssetCompiler.groovy:173)
        at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)

推荐答案

我已还原到assetPipeline插件的先前版本,可以使我进行编译而不会出现错误.

I have reverted back to the previous version of the assetPipeline plugin and that allows me to compile without error.

但是对于遇到此问题的其他任何人,我注意到在升级Grails之后,一旦将应用程序部署到Tomcat,我的战争版本就会出现问题.

But for anyone else that comes across this, I noticed that after upgrading Grails I was having issues with the war version of my application once it was deployed to Tomcat.

第一期-

war {
   archiveName "Wolf.war"
}

不再根据需要命名我的战争文件.我在另一个问题中询问了此问题第一个答案是使用bootWar而不是war,例如:

No longer named my war file as desired. I asked about this in a different question and the first answer was to use bootWar instead of war, such as:

bootWar {
   archiveName "Wolf.war"
}

这确实确实正确命名了war文件.但是,现在将war文件放入tomcat,并使其分解后,它在webapp中包含了我以前没有的org.springframework.boot.loader文件夹.这似乎不正确.此外,我不再拥有资产目录,因此部署的应用程序中缺少我所有的自定义js,css和图像.经过大量的搜寻之后,我发现了一些建议这样做的东西:

This did indeed name the war file correctly. However, now when the war file was dropped into tomcat, and tomcat exploded it, it included an org.springframework.boot.loader folder inside the webapp which I didn't previously have. This doesn't seem right. In addition, I no longer had the assets directory, so all of my custom js, css, and images were missing from the deployed app. After much googling, I found something that suggested doing this:

war {
    enabled = true
    archiveName "Wolf.war"
}

这解决了我所有的问题.我的war文件的命名正确,war文件包含资产,并且war文件不包含引导文件夹.并且,已部署的应用程序可以正常工作.因此,我不知道这是否应该是我应该做的正确"方法,但是它可以工作.

This resolved all my issues. My war file is named correctly, the war file contains the assets, and the war file does not contain the boot folder. And, the deployed app works correctly. So, I don't know if this is the "proper" way that I should be doing it, but it works.

这篇关于compileAssets无法升级Grails应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆