davidB / yuicompressor-maven-plugin

maven's plugin to compress (Minify / Ofuscate / Aggregate) Javascript files and CSS files using YUI Compressor
http://davidb.github.io/yuicompressor-maven-plugin/
GNU Lesser General Public License v2.1
122 stars 48 forks source link

Javascript Syntax Check #79

Open crajarshi opened 9 years ago

crajarshi commented 9 years ago

[INFO] --- yuicompressor-maven-plugin:1.5.1:compress (compressyui) @ icoreWeb --- [INFO] account_mgmt.js (120626b) -> account_mgmt.js (92930b)[77%] [INFO] app_progressBar.js (1467b) -> app_progressBar.js (1278b)[87%] [INFO] autoTabShiftTab.js (3578b) -> autoTabShiftTab.js (1385b)[38%] [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [804:12]: missing variable name [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 804:column 12:missing variable name var char; [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [806:11]: identifier is a reserved word [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 806:column 11:identifier is a reserved word char = strData.charAt(i); [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [807:35]: identifier is a reserved word [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 807:column 35:identifier is a reserved word if(allowedChars.indexOf(char) == -1){ [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [808:21]: syntax error [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 808:column 21:syntax error isNumber = false; [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [812:10]: invalid return [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 812:column 10:invalid return return isNumber; [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [813:1]: syntax error [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 813:column 1:syntax error } [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [818:12]: missing variable name [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 818:column 12:missing variable name var char; [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [820:11]: identifier is a reserved word [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 820:column 11:identifier is a reserved word char = strData.charAt(i); [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [821:35]: identifier is a reserved word [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 821:column 35:identifier is a reserved word if(allowedChars.indexOf(char) == -1){ [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [822:21]: syntax error [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 822:column 21:syntax error isNumber = false; [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [826:10]: invalid return [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 826:column 10:invalid return return isNumber; [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [827:1]: syntax error [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 827:column 1:syntax error } [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [829:30]: missing ; before statement [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 829:column 30:missing ; before statement function getDisplayStatus(id){ [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [838:8]: invalid return [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 838:column 8:invalid return return curDisplay; [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [839:1]: syntax error [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 839:column 1:syntax error } [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [840:39]: missing ; before statement [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 840:column 39:missing ; before statement function showTxAmtLessThanFiftyError(){ [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [841:89]: missing ; before statement [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 841:column 89:missing ; before statement if(null != document.getElementById("applicationForm:sbTellUsYourself:ErrorTxMinFifty")){ [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [842:11]: syntax error [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 842:column 11:syntax error document.getElementById("applicationForm:sbTellUsYourself:ErrorTxMinFifty").style.display="block"; [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [843:2]: syntax error [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 843:column 2:syntax error } [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [844:103]: missing ; before statement [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 844:column 103:missing ; before statement if(null != document.getElementById("applicationForm:sbIcoreValidationErrorMessages:ErrorTxMinFifty")){ [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [845:11]: syntax error [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 845:column 11:syntax error document.getElementById("applicationForm:sbIcoreValidationErrorMessages:ErrorTxMinFifty").style.display="block"; [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [846:2]: syntax error [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 846:column 2:syntax error } [ERROR] C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js [1:0]: Compilation produced 22 syntax errors. [ERROR] ...C:\Icore\icoreApp\maven.1420039858792\icoreApp\icoreWeb\src\main\minified\js\balance_transfer.js:line 1:column 0:Compilation produced 22 syntax errors. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.590s [INFO] Finished at: Wed Dec 31 12:00:00 EST 2014 [INFO] Final Memory: 35M/64M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal net.alchim31.maven:yuicompressor-maven-plugin:1.5.1:compress (compressyui) on project icoreWeb: Execution compressyui of goal net.alchim31.maven:yuicompressor-maven-plugin:1.5.1:compress failed: Compilation produced 22 syntax errors. -> [Help 1] [ERROR]


How Can I turn this feature off in Yui-Compressor Maven plugin?

My Configuration is as below

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <id>default-war</id>
                    <phase>package</phase>
                    <goals>
                        <goal>war</goal>
                    </goals>
                    <configuration>
                        <warSourceDirectory>src/main/minified</warSourceDirectory>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </execution>
            </executions>

            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
                <warSourceDirectory>src/main/minified</warSourceDirectory>
                <encoding>UTF-8</encoding>
                <webResources>
                    <resource>
                        <directory>${project.build.directory}/min</directory>
                    </resource>
                </webResources>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>yuicompressor-maven-plugin</artifactId>
            <version>1.5.1</version>
            <executions>
                <execution>
                    <id>compressyui</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>compress</goal>
                    </goals>
                    <configuration>
                        <nosuffix>true</nosuffix>
                        <failOnWarning>false</failOnWarning>
                        <warSourceDirectory>src/main/minified</warSourceDirectory>
                        <webappDirectory>${project.build.directory}/min</webappDirectory>
                        <jswarn>false</jswarn>
                        <nosuffix>true</nosuffix>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </execution>
            </executions>

        </plugin> 
davidB commented 9 years ago

If the syntax is invalid, yuicompressor can't parse it and compress it.

Ive4 commented 8 years ago

i use angularjs but is same problem how to fix it?

ettingshausen commented 7 years ago

+1

fantasylion commented 7 years ago

+1

arubalcaba commented 7 years ago

yeah I'm seeing similar behavior when trying to use the plugin. In my case its javascript I know works and has been used for a while. The javascript though has been generated using Typescript. Not sure if that could be the potential issue. @Ive4 is this what you are seeing as well in the case of the javascript generated from Angular Typescript?

AlexanderRodecape commented 6 years ago

ditto

imosapatryk commented 6 years ago

+1

Erutan409 commented 5 years ago

Any headway on this?