I use eclipse for ExtJS development, I am using ant build in eclipse, it uses Sencha cmd. My project details are
app.framework.version=5.1.0.107
app.cmd.version=5.1.0.26
when I try to build project, it fails with Yui Parse errors, but I couldn't find any error in my workspace.. Can you explain the stack trace message?
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$1.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
I'm going to go out on a limb and suggest it's because you are using a reserved word in your property name. While It's typically "okay" in javascript and your ExtJS application runs in development mode, I've found when minifying YUI chokes on these keywords.
The easiest (and probably advisable) option is just to avoid reserved keywords and name abstract something else, abstractObj for example. If you wish to force the issue, you could instead of this:
if(!Propca.view.abstract) // ...
... try array access notation:
if(!Propca.view['abstract']) // ...
... or in the particular case of the if
statement in the error message, the in
operator:
if(!('abstract' in Propca.view)) // ...
In these cases (and any others you may have) accessing the property with the keyword as a string seems to satisfy the compiler - though it breaks convention and doesn't look very neat so arguably not worth it...
You've got a syntax error in your JavaScript; when this is combined into a single file, the YUI compressor can't handle it and barfs.
Unfortunately, ExtJS doesn't have good tools for spotting errors in individual files. You could try a different tool (I use jshint, for example, as a pre-build Ant task), or you could simply look at the files that have changed since you last did a successful build and narrow it down that way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With