ExtJS 5.1 构建错误(Yui 解析错误)
ExtJS 5.1 Build Error (Yui Parse Error)
我用eclipse做ExtJS开发,
我在 eclipse 中使用 ant build,它使用 Sencha cmd。
我的项目详情是
app.framework.version=5.1.0.107
app.cmd.version=5.1.0.26
当我尝试构建项目时,它因 Yui Parse 错误而失败,但我在我的工作区中找不到任何错误..
你能解释堆栈跟踪消息吗?
page:
-before-page:
-init:
-init-compiler:
-copy-app-resources:
[x-compile] Copying page resources to D:\Users\admin\workspaceKepler\Propca\WebContent\build\production\Propca
[x-compile] C2009: YUI Parse Error (missing name after . operator => if (!Propca.view.abstract) Propca.view.abstract = {};) -- unknown-file:143:26
[x-compile] C2009: YUI Parse Error (missing name after . operator => Propca.view.abstract,) -- unknown-file:197633:25
[x-compile] C2009: YUI Parse Error (syntax error => ], 0));) -- unknown-file:197635:1
[x-compile] C2009: YUI Parse Error (missing name after . operator => Propca.view.abstract,) -- unknown-file:197657:25
[x-compile] C2009: YUI Parse Error (syntax error => ], 0));) -- unknown-file:197659:1
[x-compile] C2009: YUI Parse Error (missing name after . operator => (Ext.cmd.derive('Propca.view.querybuilder.QueryBuilder', Propca.view.abstract.PRPanel, {) -- unknown-file:197661:78
[x-compile] C2009: YUI Parse Error (syntax error => items: [) -- unknown-file:197679:15
[x-compile] C2009: YUI Parse Error (missing ; before statement => itemId: 'idbtnValidateSqlScript',) -- unknown-file:197682:24
[x-compile] C2009: YUI Parse Error (syntax error => bodypadding: '30',) -- unknown-file:197683:29
[x-compile] C2009: YUI Parse Error (syntax error => height: 30,) -- unknown-file:197684:24
[x-compile] InvocationTargetException: java.lang.reflect.InvocationTargetException
BUILD FAILED
com.sencha.exceptions.ExBuild: Failed to compress input
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.runYuiCompressor(YuiJavascriptCompressor.java:85)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:96)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:106)
at com.sencha.tools.page.PageModelBuilder.compressAsset(PageModelBuilder.java:413)
at com.sencha.tools.page.PageModelBuilder.copyResourcesToOutputDirectory(PageModelBuilder.java:398)
at com.sencha.command.compile.app.AppResourcesCommand.execute(AppResourcesCommand.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:175)
at com.sencha.cli.Command.dispatch(Command.java:43)
at com.sencha.cli.Commands.dispatch(Commands.java:64)
at com.sencha.command.compile.CompileCommands.dispatch(CompileCommands.java:308)
at com.sencha.cli.AbstractCommand.dispatch(AbstractCommand.java:124)
at com.sencha.ant.CompileTask$CompileToken.dispatchCommand(CompileTask.java:164)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.eclipse.ant.internal.launching.remote.EclipseSingleCheckExecutor.executeTargets(EclipseSingleCheckExecutor.java:30)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
Caused by: com.sencha.exceptions.ExReflect: java.lang.reflect.InvocationTargetException
at com.sencha.util.ReflectionUtil.newInstance(ReflectionUtil.java:116)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.runYuiCompressor(YuiJavascriptCompressor.java:58)
... 48 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.sencha.util.ReflectionUtil.newInstance(ReflectionUtil.java:114)
... 49 more
Caused by: org.mozilla.javascript.EvaluatorException: Compilation produced 379 syntax errors.
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sencha.tools.compressors.yui.BaseYuiCompressor.invoke(BaseYuiCompressor.java:135)
at com.sun.proxy.$Proxy9.runtimeError(Unknown Source)
at org.mozilla.javascript.Parser.parse(Parser.java:392)
at org.mozilla.javascript.Parser.parse(Parser.java:337)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
... 54 more
Total time: 1 minute 15 seconds
您的 JavaScript 中存在语法错误;当它被组合成一个文件时,YUI 压缩器无法处理它和 barfs。
不幸的是,ExtJS 没有很好的工具来发现单个文件中的错误。您可以尝试使用不同的工具(例如,我使用 jshint 作为预构建 Ant 任务),或者您可以简单地查看自上次成功构建以来发生更改的文件并以这种方式缩小范围。
我要冒险并建议这是因为您在 属性 名称中使用了 reserved word。虽然在 javascript 中通常是 "okay" 并且您的 ExtJS 应用程序在开发模式下运行,但我在缩小 YUI 时发现对这些关键字感到窒息。
最简单的 (可能也是可取的) 选项只是为了避免保留关键字和名称 abstract 其他东西, abstractObj 例如。如果你想强制这个问题,你可以代替这个:
if(!Propca.view.abstract) // ...
...尝试数组访问符号:
if(!Propca.view['abstract']) // ...
... 或者在错误消息中 if
语句的特定情况下,in
运算符:
if(!('abstract' in Propca.view)) // ...
在这些情况下 (以及您可能拥有的任何其他情况) 使用 关键字作为字符串 访问 属性 似乎满足编译器的要求——虽然它打破了惯例并且看起来不太整洁所以可以说不值得...
我用eclipse做ExtJS开发, 我在 eclipse 中使用 ant build,它使用 Sencha cmd。 我的项目详情是
app.framework.version=5.1.0.107
app.cmd.version=5.1.0.26
当我尝试构建项目时,它因 Yui Parse 错误而失败,但我在我的工作区中找不到任何错误.. 你能解释堆栈跟踪消息吗?
page:
-before-page:
-init:
-init-compiler:
-copy-app-resources:
[x-compile] Copying page resources to D:\Users\admin\workspaceKepler\Propca\WebContent\build\production\Propca
[x-compile] C2009: YUI Parse Error (missing name after . operator => if (!Propca.view.abstract) Propca.view.abstract = {};) -- unknown-file:143:26
[x-compile] C2009: YUI Parse Error (missing name after . operator => Propca.view.abstract,) -- unknown-file:197633:25
[x-compile] C2009: YUI Parse Error (syntax error => ], 0));) -- unknown-file:197635:1
[x-compile] C2009: YUI Parse Error (missing name after . operator => Propca.view.abstract,) -- unknown-file:197657:25
[x-compile] C2009: YUI Parse Error (syntax error => ], 0));) -- unknown-file:197659:1
[x-compile] C2009: YUI Parse Error (missing name after . operator => (Ext.cmd.derive('Propca.view.querybuilder.QueryBuilder', Propca.view.abstract.PRPanel, {) -- unknown-file:197661:78
[x-compile] C2009: YUI Parse Error (syntax error => items: [) -- unknown-file:197679:15
[x-compile] C2009: YUI Parse Error (missing ; before statement => itemId: 'idbtnValidateSqlScript',) -- unknown-file:197682:24
[x-compile] C2009: YUI Parse Error (syntax error => bodypadding: '30',) -- unknown-file:197683:29
[x-compile] C2009: YUI Parse Error (syntax error => height: 30,) -- unknown-file:197684:24
[x-compile] InvocationTargetException: java.lang.reflect.InvocationTargetException
BUILD FAILED
com.sencha.exceptions.ExBuild: Failed to compress input
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.runYuiCompressor(YuiJavascriptCompressor.java:85)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:96)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:106)
at com.sencha.tools.page.PageModelBuilder.compressAsset(PageModelBuilder.java:413)
at com.sencha.tools.page.PageModelBuilder.copyResourcesToOutputDirectory(PageModelBuilder.java:398)
at com.sencha.command.compile.app.AppResourcesCommand.execute(AppResourcesCommand.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:175)
at com.sencha.cli.Command.dispatch(Command.java:43)
at com.sencha.cli.Commands.dispatch(Commands.java:64)
at com.sencha.command.compile.CompileCommands.dispatch(CompileCommands.java:308)
at com.sencha.cli.AbstractCommand.dispatch(AbstractCommand.java:124)
at com.sencha.ant.CompileTask$CompileToken.dispatchCommand(CompileTask.java:164)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.eclipse.ant.internal.launching.remote.EclipseSingleCheckExecutor.executeTargets(EclipseSingleCheckExecutor.java:30)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
Caused by: com.sencha.exceptions.ExReflect: java.lang.reflect.InvocationTargetException
at com.sencha.util.ReflectionUtil.newInstance(ReflectionUtil.java:116)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.runYuiCompressor(YuiJavascriptCompressor.java:58)
... 48 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.sencha.util.ReflectionUtil.newInstance(ReflectionUtil.java:114)
... 49 more
Caused by: org.mozilla.javascript.EvaluatorException: Compilation produced 379 syntax errors.
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sencha.tools.compressors.yui.BaseYuiCompressor.invoke(BaseYuiCompressor.java:135)
at com.sun.proxy.$Proxy9.runtimeError(Unknown Source)
at org.mozilla.javascript.Parser.parse(Parser.java:392)
at org.mozilla.javascript.Parser.parse(Parser.java:337)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
... 54 more
Total time: 1 minute 15 seconds
您的 JavaScript 中存在语法错误;当它被组合成一个文件时,YUI 压缩器无法处理它和 barfs。
不幸的是,ExtJS 没有很好的工具来发现单个文件中的错误。您可以尝试使用不同的工具(例如,我使用 jshint 作为预构建 Ant 任务),或者您可以简单地查看自上次成功构建以来发生更改的文件并以这种方式缩小范围。
我要冒险并建议这是因为您在 属性 名称中使用了 reserved word。虽然在 javascript 中通常是 "okay" 并且您的 ExtJS 应用程序在开发模式下运行,但我在缩小 YUI 时发现对这些关键字感到窒息。
最简单的 (可能也是可取的) 选项只是为了避免保留关键字和名称 abstract 其他东西, abstractObj 例如。如果你想强制这个问题,你可以代替这个:
if(!Propca.view.abstract) // ...
...尝试数组访问符号:
if(!Propca.view['abstract']) // ...
... 或者在错误消息中 if
语句的特定情况下,in
运算符:
if(!('abstract' in Propca.view)) // ...
在这些情况下 (以及您可能拥有的任何其他情况) 使用 关键字作为字符串 访问 属性 似乎满足编译器的要求——虽然它打破了惯例并且看起来不太整洁所以可以说不值得...