google-code-export / wro4j

Automatically exported from code.google.com/p/wro4j
1 stars 1 forks source link

JSHint maven plugin fails when using multiple options, example: predef=["angular","skf"] #698

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The javascript itself is not involved since the error is in the option parsing 
so I get the same exception multiple times, once for each file. I use latest 
version 1.6.3 of wro4j-maven-plugin.

            <plugin>
                <groupId>ro.isdc.wro4j</groupId>
                <artifactId>wro4j-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>jshint</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <options>devel,noarg,globalstrict,sub,browser,predef=["angular","skf"]</options>
                </configuration>
            </plugin>

This is the error I get:

js: "check", line 1: missing ] after element list
js: JSHINT(["'use strict';","","/**"," * Directive (Widget) showing the last X 
customers"," * Usage: <last-customers></last-customers>"," 
*/","angular.module('skf.directives')","  .directive('lastCustomers', 
['$location', 'customerService', 'textService', function ($location, 
customerService, textService) {","    return {","      restrict: 'E',","      
replace: true,","      template: '<select ng-model=\"selectedCustomer\"  
ng-options=\"c.ssn for c in lastCustomers\" ng-change=\"goToCustomer()\">' +"," 
       '<option></option>' +","        '</select>',","      link: function 
(scope, element, attrs) {","        scope.goToCustomer = function () {","       
   if (scope.selectedCustomer) {","            $location.path('/customer/' + 
scope.selectedCustomer.ssn);","          }","        };","        var 
lastCustomersText = angular.element(element.children()[0]);","","        
textService.getText('last_customer', function (data) {","          
lastCustomersText.text(data.texts['common.text.last_customer_default']);","     
   });","","        customerService.lastCustomers(function (data) {","          
scope.lastCustomers = data;","        });","      }","    };","  
}]);"].join("\n"), {"devel": true,"noarg": true,"globalstrict": true,"sub": 
true,"browser": true,"predef": ["angular",""skf"]": true});
js: 

2038 WARN JsHintProcessor      - Exception while applying  processor on the 
[/js/directives/lastCustomersDirective.js] resource, no processing applied...
ro.isdc.wro.WroRuntimeException: Could not execute the script because: 
Compilation produced 1 syntax errors. (check#1)
    at ro.isdc.wro.extensions.processor.support.jshint.JsHint.validate(JsHint.java:104)
    at ro.isdc.wro.extensions.processor.js.JsHintProcessor.process(JsHintProcessor.java:57)
    at ro.isdc.wro.maven.plugin.JsHintMojo$1.process(JsHintMojo.java:41)
    at ro.isdc.wro.model.group.processor.PreProcessorExecutor.applyPreProcessors(PreProcessorExecutor.java:113)
    at ro.isdc.wro.model.group.processor.PreProcessorExecutor.processSingleResource(PreProcessorExecutor.java:81)
    at ro.isdc.wro.model.group.processor.PreProcessorExecutor.processAndMerge(PreProcessorExecutor.java:58)
    at ro.isdc.wro.model.group.processor.GroupsProcessor.process(GroupsProcessor.java:64)
    at ro.isdc.wro.manager.WroManager.getContentHashEntry(WroManager.java:284)
    at ro.isdc.wro.manager.WroManager.buildGroupsInputStream(WroManager.java:187)
    at ro.isdc.wro.manager.WroManager.process(WroManager.java:124)
    at ro.isdc.wro.maven.plugin.AbstractSingleProcessorMojo.processGroup(AbstractSingleProcessorMojo.java:83)
    at ro.isdc.wro.maven.plugin.AbstractSingleProcessorMojo.doExecute(AbstractSingleProcessorMojo.java:60)
    at ro.isdc.wro.maven.plugin.AbstractWro4jMojo.execute(AbstractWro4jMojo.java:104)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    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:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    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:601)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.mozilla.javascript.EvaluatorException: Compilation produced 1 
syntax errors. (check#1)
    at org.mozilla.javascript.tools.ToolErrorReporter.runtimeError(ToolErrorReporter.java:144)
    at org.mozilla.javascript.Parser.parse(Parser.java:415)
    at org.mozilla.javascript.Parser.parse(Parser.java:338)
    at org.mozilla.javascript.Context.compileImpl(Context.java:2368)
    at org.mozilla.javascript.Context.compileString(Context.java:1359)
    at org.mozilla.javascript.Context.compileString(Context.java:1348)
    at org.mozilla.javascript.Context.evaluateString(Context.java:1101)
    at ro.isdc.wro.extensions.script.RhinoScriptBuilder.evaluate(RhinoScriptBuilder.java:193)
    at ro.isdc.wro.extensions.processor.support.jshint.JsHint.validate(JsHint.java:91)
    ... 39 more

What should be noted from the error is the options that gets passed to JSHint: 
{"devel": true,"noarg": true,"globalstrict": true,"sub": true,"browser": 
true,"predef": ["angular",""skf"]": true}  
It seems like wro4j parses predef=["angular","skf"] as two different params, 
"predef": ["angular" and ""skf"]": true    - which is obviously wrong.

predef=["angular"] works great (just using an array with one element) but with 
several elements I get the error.

Original issue reported on code.google.com by alex.obj...@gmail.com on 2 Apr 2013 at 1:02

GoogleCodeExporter commented 9 years ago
I cannot reproduce it myself. Probably this can be reproduced only when using 
the lastCustomersDirective.js resource. Could you attach it here? 

Original comment by alex.obj...@gmail.com on 25 Apr 2013 at 9:33

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 25 Apr 2013 at 9:40

GoogleCodeExporter commented 9 years ago
Feel free to reopen it when more details are available. Until then, closing 
this issue with INVALID status.

Original comment by alex.obj...@gmail.com on 24 May 2013 at 3:38