Open theTestTube opened 12 years ago
There currently is not, but I'm sure it's not that difficult to add. I didn't realize that Closure was finally getting good about putting out their stable releases. I'll get something integrated shortly to do that. We'd definitely want to upgrade the version that our team is using as well.
Mmmm... might not be the closure compiler version but the default options (more restrictive) your plugin has. I've tried again with r1592 version and the following plugin configuration and didn't have compilation errors.
<compileLevel>SIMPLE_OPTIMIZATIONS</compileLevel>
<errorLevel>SIMPLE</errorLevel>
I also suppose configuring a closure version is an unimplemented feature, not a bug. Sorry!
No Worries,
I chose the default values to be very strict to help ensure proper coding against the compiler. This is all wrapped up in the "errorLevel" configuration. If you set this to STRICT (default) it will fail a build any time you do something that Closure compiler is not happy about. If you set this to WARNING, it will give you warnings that would be similar to if you set "--warning_level=VERBOSE" (http://code.google.com/p/closure-compiler/wiki/Warnings) on the python script.
Note that if you change the compilerLevel to use SIMPLE_OPTIMIZATIONS, though, you are changing how the compiler is going to compile and minify your files (possibly not what you want). Here's a description of the compiler levels: https://developers.google.com/closure/compiler/docs/compilation_levels. By adjusting this, you are removing some of the really cool optimizations that Closure is giving to you. However, if you just want to minify your code using the Closure (still better than most of the minification libraries out there), this is the way to go.
I'll try and post this as a FAQ too, just in case it comes up. Thanks for the help testing it out!
Oh, if it helps out, I messed with Maven and it looks like you can use the maven dependency resolution to get the newest version of the closure compiler. I can add the dependency to the local pom to get the newer version of the Closure compiler, which is pretty easy to do. I added this to the FAQ on the wiki section too.
Please notice on my side, with Maven 3.0, it's inside the plugin dependencies where overriden closure-compiler version must be set (if set at pom plugins take their own version, otherwise touching a pom version could cause trouble to its providers!),
<plugin>
<groupId>com.github.jlgrock.javascript-framework</groupId>
<artifactId>closure-compiler-maven-plugin</artifactId>
<version>1.11.13</version>
<executions>
<execution>
<id>q-js-compile</id>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<compileLevel>SIMPLE_OPTIMIZATIONS</compileLevel>
<errorLevel>SIMPLE</errorLevel>
<inclusionStrategy>WHEN_IN_SRCS</inclusionStrategy>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.javascript</groupId>
<artifactId>closure-compiler</artifactId>
<version>r1918</version>
</dependency>
</dependencies>
</plugin>
And when using r1918 Closure version it's not even compiling, failing with the following exception,
[ERROR] (JsClosureCompileMojo.java:442) There was a problem with the compile. Please review input.java.lang.ArrayStoreException at java.util.ArrayList.toArray(ArrayList.java:306) at com.github.jlgrock.javascriptframework.closurecompiler.JsClosureCompileMojo.compile(JsClosureCompileMojo.java:437) at com.github.jlgrock.javascriptframework.closurecompiler.JsClosureCompileMojo.execute(JsClosureCompileMojo.java:525) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at [...] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) org.apache.maven.plugin.MojoExecutionException at com.github.jlgrock.javascriptframework.closurecompiler.JsClosureCompileMojo.compile(JsClosureCompileMojo.java:444) at com.github.jlgrock.javascriptframework.closurecompiler.JsClosureCompileMojo.execute(JsClosureCompileMojo.java:525) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at [...] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
You are absolutely right. I put it in the wrong section and it gave me a false positive build. Go me.
As for the newest version of the compiler (r1910), that's not going to work. Whatever they put out on the maven repo has a corrupt header and will not work. I was able to make the compiler with r1810. I've checked in the code for that but I want to test it out a little more before releasing a new patch to the maven repo. Also, there's some code that another user just checked in to help to use async test cases. I'll try and wrap that all into a new version and kick it out sometime early next week as a 1.12.0 release.
Good work, you rock!
With the releases below I'm having some JavaScript compilation errors that I don't suffer when using the latest (r1971) closure-compiler release.
closure-compiler-maven-plugin:1.11.13:js-closure-compiler com.google.javascript:closure-compiler:jar:r1592
Is it possible configuring compiler version? I've tried setting "closure-compiler.version=r1971" on Maven startup but doesn't work.
Many, many thanks for your contribution.-