grunt-closure-compiler
grunt-closure-compiler copied to clipboard
CLOSURE_PATH location issues on Win7
Hello All,
I've tried every variation I can think of to get this working. I've used the closurePath param, I've used system variables, but I cannot get this task to run without it failing, telling me that it cannot find the jar.
Is anyone else having issues on Windows or is it just me? My grunt.js file is in a root directory. I've added a 'Closure Compiler' directory with the compiler.jar file inside. It's one level up. Here are some example values I've set for the closurePath -
closurePath: '',
closurePath: '/',
closurePath: 'Closure Compiler',
closurePath: '/Closure Compiler',
closurePath: 'Closure Compiler/',
closurePath: '/Closure Compiler/',
closurePath: 'Closure Compiler/compiler',
closurePath: '/Closure Compiler/compiler',
closurePath: 'Closure Compiler/compiler.jar',
closurePath: '/Closure Compiler/compiler.jar',
Nothing works. I've tried every variation I thought it could be. Here's my object as it stands now:
'closure-compiler' : { frontend: { closurePath : 'Closure Compiler/', js : 'components/footer.js', jsOutputFile: 'js/footer.min.js', maxBuffer : 500, options : { compilation_level: 'SIMPLE_OPTIMIZATIONS' } } },
Hi man! Sorry for the delay.
How did you install Closure Compiler (From source or just downloaded the jar)? Where is it now?
You just pass the full path of your install to closurePath
and it should work.
I just used a jar.
I downloaded the jar and placed it here: C:\Users\Name\Dropbox\Closure Compiler\compiler.jar
The grunt.js file is here: C:\Users\Name\Dropbox\grunt.js
I've tried all the settings above as well as using the full path above. Have you been able to run this on windows? This is the warning I'm getting:
"Command failed: Unable to access jarfile C:/Users/Name/Dropbox/Closure Use --force to continue."
Seems like it's having issues reading the whole folder path.
Hi,
My 2 cents in form of an educated guess: issue with whitespace in the path and fix would be similar to this one https://github.com/yeoman/yeoman/pull/873 ?
Little late to reply but anyway, after fixing the whitespace issue, you will need to move your built files to inside a /build
subdirectory.
For example, using this setting:
closurePath: 'C:/closure'
Your compiler.jar
should be at:
C:/closure/build/compiler.jar
This is because this grunt task currently appends /build/compiler.jar
to the closurePath
(see here).
Now I'm getting an issue. Ive installed using npm package manager and I am using grunt to run it. Downloaded jar file, pasted it into a build folder inside node_modules/grunt-closure-compiler and run Now the issue is this, java error.
Warning: Command failed: Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CommandLineRunner : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Use --force to continue.
Looks like version error. What should I do now? Using npm install grunt-closure-compiler doesnt download build/compiler.jar file. Ive manually downloaded jar file and used, but still problem. I've given path like this: closurePath: 'node_modules/grunt-closure-compiler', Any solution for me. I am in a mac machine.