在构建sencha touch项目时,我遇到错误[ERR] Failed to compress input
。所以我用-d
(debug)标志重新编译了它,输出如下。
[DBG] Load url is file:/opt/Sencha/Cmd/3.1.2.342/lib/yuicompressor-2.4.7.jar
[ERR] Failed to compress input
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.runYuiCompressor(YuiJavascriptCompressor.java:149)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:160)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:170)
at com.sencha.tools.compiler.jsb.projects.Project.compressTarget(Project.java:130)
at com.sencha.tools.compiler.jsb.projects.Target.afterCreate(Target.java:135)
at com.sencha.tools.compiler.jsb.projects.Build.afterCreate(Build.java:103)
at com.sencha.tools.compiler.jsb.projects.Target.create(Target.java:79)
at com.sencha.tools.compiler.jsb.projects.Project.createBuilds(Project.java:103)
at com.sencha.tools.compiler.jsb.projects.Project.build(Project.java:89)
at com.sencha.tools.compiler.jsb.projects.JsbBuilder.processBuild(JsbBuilder.java:57)
at com.sencha.command.build.JsbCommand.execute(JsbCommand.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:174)
at com.sencha.cli.Command.dispatch(Command.java:42)
at com.sencha.cli.Commands.dispatch(Commands.java:62)
at com.sencha.command.Sencha.dispatch(Sencha.java:78)
at com.sencha.command.Sencha.main(Sencha.java:141)
Caused by: java.lang.reflect.InvocationTargetException
at com.sencha.util.ReflectionUtil.newInstance(ReflectionUtil.java:120)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.runYuiCompressor(YuiJavascriptCompressor.java:114)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:160)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:170)
at com.sencha.tools.compiler.jsb.projects.Project.compressTarget(Project.java:130)
at com.sencha.tools.compiler.jsb.projects.Target.afterCreate(Target.java:135)
at com.sencha.tools.compiler.jsb.projects.Build.afterCreate(Build.java:103)
at com.sencha.tools.compiler.jsb.projects.Target.create(Target.java:79)
at com.sencha.tools.compiler.jsb.projects.Project.createBuilds(Project.java:103)
at com.sencha.tools.compiler.jsb.projects.Project.build(Project.java:89)
at com.sencha.tools.compiler.jsb.projects.JsbBuilder.processBuild(JsbBuilder.java:57)
at com.sencha.command.build.JsbCommand.execute(JsbCommand.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:174)
at com.sencha.cli.Command.dispatch(Command.java:42)
at com.sencha.cli.Commands.dispatch(Commands.java:62)
at com.sencha.command.Sencha.dispatch(Sencha.java:78)
at com.sencha.command.Sencha.main(Sencha.java:141)
Caused by: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at com.sencha.util.ReflectionUtil.newInstance(ReflectionUtil.java:116)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.runYuiCompressor(YuiJavascriptCompressor.java:114)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:160)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:170)
at com.sencha.tools.compiler.jsb.projects.Project.compressTarget(Project.java:130)
at com.sencha.tools.compiler.jsb.projects.Target.afterCreate(Target.java:135)
at com.sencha.tools.compiler.jsb.projects.Build.afterCreate(Build.java:103)
at com.sencha.tools.compiler.jsb.projects.Target.create(Target.java:79)
at com.sencha.tools.compiler.jsb.projects.Project.createBuilds(Project.java:103)
at com.sencha.tools.compiler.jsb.projects.Project.build(Project.java:89)
at com.sencha.tools.compiler.jsb.projects.JsbBuilder.processBuild(JsbBuilder.java:57)
at com.sencha.command.build.JsbCommand.execute(JsbCommand.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:174)
at com.sencha.cli.Command.dispatch(Command.java:42)
at com.sencha.cli.Commands.dispatch(Commands.java:62)
at com.sencha.command.Sencha.dispatch(Sencha.java:78)
at com.sencha.command.Sencha.main(Sencha.java:141)
Caused by: null
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSourceNumber(JavaScriptCompressor.java:299)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:336)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at com.sencha.util.ReflectionUtil.newInstance(ReflectionUtil.java:116)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.runYuiCompressor(YuiJavascriptCompressor.java:114)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:160)
at com.sencha.tools.compressors.yui.YuiJavascriptCompressor.compress(YuiJavascriptCompressor.java:170)
at com.sencha.tools.compiler.jsb.projects.Project.compressTarget(Project.java:130)
at com.sencha.tools.compiler.jsb.projects.Target.afterCreate(Target.java:135)
at com.sencha.tools.compiler.jsb.projects.Build.afterCreate(Build.java:103)
at com.sencha.tools.compiler.jsb.projects.Target.create(Target.java:79)
at com.sencha.tools.compiler.jsb.projects.Project.createBuilds(Project.java:103)
at com.sencha.tools.compiler.jsb.projects.Project.build(Project.java:89)
at com.sencha.tools.compiler.jsb.projects.JsbBuilder.processBuild(JsbBuilder.java:57)
at com.sencha.command.build.JsbCommand.execute(JsbCommand.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:174)
at com.sencha.cli.Command.dispatch(Command.java:42)
at com.sencha.cli.Commands.dispatch(Commands.java:62)
at com.sencha.command.Sencha.dispatch(Sencha.java:78)
at com.sencha.command.Sencha.main(Sencha.java:141)
同样的代码构建在其他所有机器上。我正在使用Sencha Cmd v3.1.2.342
。在以下配置中进行了测试。
- 机器1
- Sencha CMD 3.1.2.342
- Java 1.6
- 32位Fedora 12
- 构建失败
- 机器2
- Sencha CMD 3.1.2.342
- Java 1.6
- 32位Fedora 15
- 构建过程
- 机器3
- Sencha CMD 3.0.0
- Java 1.6
- 64位Ubuntu 12.04
- 构建过程
我使用Sencha CMD只使用.jsb3
文件进行构建。
失败的原因是什么?
问题已解决。以下是我所做的。
- 重新安装或
ant
和java
。注意,我从一开始就使用了OpenJDK,而不是Sun Java。因此,安装Sun Java可能是一个不错的选择 - 将整台机器更新为最新的软件包。(Fedora为
yum update
,Ubuntu为apt-get upgrade
)