Google Closure使用 IKVM在没有 Java 运行时环境的情况下工作得很好
如果它消失了,将其转换为 exe 的简化步骤是:
- 下载并解压(但无需安装)Closure Compiler和IKVM
- 将 compiler.jar 移动到 IKVM bin 文件夹
ikvmc -target:exe -fileversion:2012.09.17 .\compiler.jar
(带有罐子的发布日期)。注意:我收到一些关于 ANT 库的警告。- 将这些依赖项从 ikvm bin 目录复制到闭包目录:
- IKVM.OpenJDK.Core.dll
- IKVM.OpenJDK.Jdbc.dll
- IKVM.OpenJDK.Misc.dll
- IKVM.OpenJDK.SwingAWT.dll
- IKVM.OpenJDK.Text.dll
- IKVM.OpenJDK.Util.dll
- XML.API.dll
- IKVM.Runtime.dll
然后你可以将 compiler.jar 和新的 compiler.exe 移回你的闭包目录。Fredrik 推荐这个powershell版本的执行,因为它能够指定 ascii 编码覆盖 unicode(一半字节):
.\compiler.exe --js .\jquery-1.4.2.js --warning_level QUIET | out-file -encoding ascii .\jquery.min.js
===============================
但是,我对 Closure Templates 的SoyToJsSrcCompiler.jar
. 我收到来自ikvmc -target:exe -fileversion:2011.12.22 .\SoyToJsSrcCompiler.jar
with 的警告compiler.jar
。
warning IKVMC0105: Unable to compile class "com.google.template.soy.jssrc.internal.GenerateSoyUtilsEscapingDirectiveCode"
(missing class "org.apache.tools.ant.Task")
warning IKVMC0100: Class "com.google.inject.internal.asm.util.$TraceClassVisitor" not found
warning IKVMC0111: Emitted java.lang.NoClassDefFoundError in "com.google.inject.internal.cglib.core.$DebuggingClassWriter$1.run()Ljava.lang.Object;"
("com.google.inject.internal.asm.util.$TraceClassVisitor")
warning IKVMC0100: Class "com.google.template.soy.jssrc.internal.GenerateSoyUtilsEscapingDirectiveCode" not found
没有命令行参数的结果SoyToJsSrcCompiler.exe
可以显示帮助页面,但提供 .soy 文件会给出:
Exception in thread "main" cli.System.MethodAccessException:
com.google.inject.assistedinject.FactoryProvider2.getBindingFromNewInjector(java.lang.reflect.Method, System.Object[], AssistData) at
com.google.inject.assistedinject.FactoryProvider2$$FastClassByGuice$$9dcdf6d7.invoke() at
com.google.inject.internal.cglib.reflect.$FastMethod.invoke(FastMethod.java:53) at
com.google.inject.internal.SingleMethodInjector$1.invoke(SingleMethodInjector.java:56) at
com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:90) at
com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:107) at
com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:76) at
com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:73) at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031) at
com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:88) at
com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:150) at
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40) at
com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:53) at
com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:11 6) at
com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:11 0) at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024) at
com.google.inject.internal.InjectionRequestProcessor$StaticInjection.injectMembers(InjectionRequestProcessor. java:110) at
com.google.inject.internal.InjectionRequestProcessor.injectMembers(InjectionRequestProcessor.java:78) at
com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:171) at
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:111) at
com.google.inject.Guice.createInjector(Guice.java:95) at
com.google.inject.Guice.createInjector(Guice.java:72) at
com.google.template.soy.MainClassUtils.createInjector(MainClassUtils.java:212) at
com.google.template.soy.SoyToJsSrcCompiler.execMain(SoyToJsSrcCompiler.java:223) at
com.google.template.soy.SoyToJsSrcCompiler.main(SoyToJsSrcCompiler.java:205)
有谁知道如何让它工作?