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

Yuicompressor plugin getting StackOverflowError #93

Closed nimmanapallivenu closed 4 years ago

nimmanapallivenu commented 6 years ago

Configuration in pom file.

                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>yuicompressor-maven-plugin</artifactId>
                     <version>1.5.1</version>
                    <configuration>
                        <nosuffix>true</nosuffix>
                        <webappDirectory>${project.build.directory}/min</webappDirectory>
                        <statistics>false</statistics>
                        <jswarn>false</jswarn>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>compress</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <configuration>
                        <webResources>
                            <resource>
                                <directory>${project.build.directory}/min</directory>
                            </resource>
                        </webResources>
                    </configuration>
                </plugin>

getting below error

Exception in thread "main" java.lang.StackOverflowError at java.util.regex.Pattern$GroupTail.match(Pattern.java:4227) at java.util.regex.Pattern$BranchConn.match(Pattern.java:4078) at java.util.regex.Pattern$CharProperty.match(Pattern.java:3345) at java.util.regex.Pattern$Branch.match(Pattern.java:4114) at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168) at java.util.regex.Pattern$Loop.match(Pattern.java:4295) at java.util.regex.Pattern$GroupTail.match(Pattern.java:4227) at java.util.regex.Pattern$BranchConn.match(Pattern.java:4078) at java.util.regex.Pattern$CharProperty.match(Pattern.java:3345)

davidB commented 6 years ago

can you provide more info ? like

nimmanapallivenu commented 6 years ago

Thanks lot for your quick response @davidB Maven goal is clean install please find the other part of logs below.

 --- maven-compiler-plugin:3.1:compile (default-compile) @ App ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 903 source files to D:\Projects\App\target\classes
[WARNING] Note: Some input files use unchecked or unsafe operations.
[WARNING] Note: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ App ---
[INFO] Not copying test resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ App ---
[INFO] Not compiling test sources
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ App ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- yuicompressor-maven-plugin:1.5.1:compress (default) @ App ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.518 s
[INFO] Finished at: 2018-02-15T19:37:14+05:30
[INFO] Final Memory: 39M/539M
[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/aether-api-1.0.0.v20140518.jar
constituent[1]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/aether-connector-basic-1.0.0.v20140518.jar
constituent[2]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/aether-impl-1.0.0.v20140518.jar
constituent[3]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/aether-spi-1.0.0.v20140518.jar
constituent[4]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/aether-transport-wagon-1.0.0.v20140518.jar
constituent[5]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/aether-util-1.0.0.v20140518.jar
constituent[6]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/aopalliance-1.0.jar
constituent[7]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/cdi-api-1.0.jar
constituent[8]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/commons-cli-1.2.jar
constituent[9]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/commons-io-2.2.jar
constituent[10]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/commons-lang-2.6.jar
constituent[11]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/guava-18.0.jar
constituent[12]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/javax.inject-1.jar
constituent[13]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/jsoup-1.7.2.jar
constituent[14]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/jsr250-api-1.0.jar
constituent[15]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/maven-aether-provider-3.2.5.jar
constituent[16]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/maven-artifact-3.2.5.jar
constituent[17]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/maven-compat-3.2.5.jar
constituent[18]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/maven-core-3.2.5.jar
constituent[19]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/maven-embedder-3.2.5.jar
constituent[20]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/maven-model-3.2.5.jar
constituent[21]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/maven-model-builder-3.2.5.jar
constituent[22]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/maven-plugin-api-3.2.5.jar
constituent[23]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/maven-repository-metadata-3.2.5.jar
constituent[24]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/maven-settings-3.2.5.jar
constituent[25]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/maven-settings-builder-3.2.5.jar
constituent[26]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/org.eclipse.sisu.inject-0.3.0.M1.jar
constituent[27]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/org.eclipse.sisu.plexus-0.3.0.M1.jar
constituent[28]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/plexus-cipher-1.7.jar
constituent[29]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/plexus-component-annotations-1.5.5.jar
constituent[30]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/plexus-interpolation-1.21.jar
constituent[31]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/plexus-sec-dispatcher-1.3.jar
constituent[32]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/plexus-utils-3.0.20.jar
constituent[33]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/sisu-guice-3.2.3-no_aop.jar
constituent[34]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/slf4j-api-1.7.5.jar
constituent[35]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/slf4j-simple-1.7.5.jar
constituent[36]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/wagon-file-2.8.jar
constituent[37]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/wagon-http-2.8-shaded.jar
constituent[38]: ffile:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/wagon-http-shared-2.8.jar
constituent[39]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/lib/wagon-provider-api-2.8.jar
constituent[40]: file:/D:/Projects/App/Softwares/apache-maven-3.2.5/conf/logging/
---------------------------------------------------
---------------------------------------------------
Exception in thread "main" java.lang.StackOverflowError
davidB commented 6 years ago

Sorry, I was not clear "the full stacktrace or at least the part before the loop in java.util.regex" I mean what is before in the call stack => below in log, because Stacktrace are dumped in reverse of order call. What I need is to know what is calling the code that seems to loop "aka java.util.regex.Pattern$CharProperty.match"

And I don't understand why you have Exception after "BUILD SUCCESS".

note: enclose code, dump,... between triple backquote (I updated your previous comment)

jaymes-bearden commented 5 years ago

I hate to resurrect a decently old thread, but I am having the same issue. Only difference for myself is that I'm on maven 3.6.0.

My configuration:

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>yuicompressor-maven-plugin</artifactId>
    <version>1.5.1</version>
    <executions>
        <execution>
            <id>default-cli</id>
            <goals>
                <goal>compress</goal>
            </goals>
            <configuration>
                <nosuffix>true</nosuffix>
                <excludes>
                    <exclude>**/*.js</exclude>
                </excludes>
                <aggregations>
                    <aggregation>
                        <insertNewLine>true</insertNewLine>
                        <output>${project.build.directory}/${project.build.finalName}/resources/styles/web-min.css</output>
                        <includes>
                            <include>**/web.css</include>
                            <include>**/site.css</include>
                            <include>**/*.css</include>
                        </includes>
                        <excludes>
                            <exclude>**/crm.css</exclude>
                            <exclude>**/crm-min.css</exclude>
                            <exclude>**/web-min.css</exclude>
                        </excludes>
                    </aggregation>
                    <aggregation>
                        <insertNewLine>true</insertNewLine>
                        <output>${project.build.directory}/${project.build.finalName}/resources/styles/crm-min.css</output>
                        <includes>
                            <include>**/crm.css</include>
                            <include>**/site.css</include>
                            <include>**/*.css</include>
                        </includes>
                        <excludes>
                            <exclude>**/web.css</exclude>
                            <exclude>**/crm-min.css</exclude>
                            <exclude>**/web-min.css</exclude>
                        </excludes>
                    </aggregation>
                </aggregations>
            </configuration>
        </execution>
    </executions>
</plugin>

Exception looks identical:

constituent[0]: file:/C:/apps/maven-3.6.0/conf/logging/
constituent[1]: file:/C:/apps/maven-3.6.0/lib/animal-sniffer-annotations-1.14.jar
constituent[2]: file:/C:/apps/maven-3.6.0/lib/aopalliance-1.0.jar
constituent[3]: file:/C:/apps/maven-3.6.0/lib/cdi-api-1.0.jar
constituent[4]: file:/C:/apps/maven-3.6.0/lib/checker-compat-qual-2.0.0.jar
constituent[5]: file:/C:/apps/maven-3.6.0/lib/commons-cli-1.4.jar
constituent[6]: file:/C:/apps/maven-3.6.0/lib/commons-io-2.5.jar
constituent[7]: file:/C:/apps/maven-3.6.0/lib/commons-lang3-3.8.1.jar
constituent[8]: file:/C:/apps/maven-3.6.0/lib/error_prone_annotations-2.1.3.jar
constituent[9]: file:/C:/apps/maven-3.6.0/lib/guava-25.1-android.jar
constituent[10]: file:/C:/apps/maven-3.6.0/lib/guice-4.2.1-no_aop.jar
constituent[11]: file:/C:/apps/maven-3.6.0/lib/j2objc-annotations-1.1.jar
constituent[12]: file:/C:/apps/maven-3.6.0/lib/jansi-1.17.1.jar
constituent[13]: file:/C:/apps/maven-3.6.0/lib/javax.inject-1.jar
constituent[14]: file:/C:/apps/maven-3.6.0/lib/jcl-over-slf4j-1.7.25.jar
constituent[15]: file:/C:/apps/maven-3.6.0/lib/jsr250-api-1.0.jar
constituent[16]: file:/C:/apps/maven-3.6.0/lib/jsr305-3.0.2.jar
constituent[17]: file:/C:/apps/maven-3.6.0/lib/maven-artifact-3.6.0.jar
constituent[18]: file:/C:/apps/maven-3.6.0/lib/maven-builder-support-3.6.0.jar
constituent[19]: file:/C:/apps/maven-3.6.0/lib/maven-compat-3.6.0.jar
constituent[20]: file:/C:/apps/maven-3.6.0/lib/maven-core-3.6.0.jar
constituent[21]: file:/C:/apps/maven-3.6.0/lib/maven-embedder-3.6.0.jar
constituent[22]: file:/C:/apps/maven-3.6.0/lib/maven-model-3.6.0.jar
constituent[23]: file:/C:/apps/maven-3.6.0/lib/maven-model-builder-3.6.0.jar
constituent[24]: file:/C:/apps/maven-3.6.0/lib/maven-plugin-api-3.6.0.jar
constituent[25]: file:/C:/apps/maven-3.6.0/lib/maven-repository-metadata-3.6.0.jar
constituent[26]: file:/C:/apps/maven-3.6.0/lib/maven-resolver-api-1.3.1.jar
constituent[27]: file:/C:/apps/maven-3.6.0/lib/maven-resolver-connector-basic-1.3.1.jar
constituent[28]: file:/C:/apps/maven-3.6.0/lib/maven-resolver-impl-1.3.1.jar
constituent[29]: file:/C:/apps/maven-3.6.0/lib/maven-resolver-provider-3.6.0.jar
constituent[30]: file:/C:/apps/maven-3.6.0/lib/maven-resolver-spi-1.3.1.jar
constituent[31]: file:/C:/apps/maven-3.6.0/lib/maven-resolver-transport-wagon-1.3.1.jar
constituent[32]: file:/C:/apps/maven-3.6.0/lib/maven-resolver-util-1.3.1.jar
constituent[33]: file:/C:/apps/maven-3.6.0/lib/maven-settings-3.6.0.jar
constituent[34]: file:/C:/apps/maven-3.6.0/lib/maven-settings-builder-3.6.0.jar
constituent[35]: file:/C:/apps/maven-3.6.0/lib/maven-shared-utils-3.2.1.jar
constituent[36]: file:/C:/apps/maven-3.6.0/lib/maven-slf4j-provider-3.6.0.jar
constituent[37]: file:/C:/apps/maven-3.6.0/lib/org.eclipse.sisu.inject-0.3.3.jar
constituent[38]: file:/C:/apps/maven-3.6.0/lib/org.eclipse.sisu.plexus-0.3.3.jar
constituent[39]: file:/C:/apps/maven-3.6.0/lib/plexus-cipher-1.7.jar
constituent[40]: file:/C:/apps/maven-3.6.0/lib/plexus-component-annotations-1.7.1.jar
constituent[41]: file:/C:/apps/maven-3.6.0/lib/plexus-interpolation-1.25.jar
constituent[42]: file:/C:/apps/maven-3.6.0/lib/plexus-sec-dispatcher-1.4.jar
constituent[43]: file:/C:/apps/maven-3.6.0/lib/plexus-utils-3.1.0.jar
constituent[44]: file:/C:/apps/maven-3.6.0/lib/slf4j-api-1.7.25.jar
constituent[45]: file:/C:/apps/maven-3.6.0/lib/wagon-file-3.2.0.jar
constituent[46]: file:/C:/apps/maven-3.6.0/lib/wagon-http-3.2.0-shaded.jar
constituent[47]: file:/C:/apps/maven-3.6.0/lib/wagon-provider-api-3.2.0.jar
---------------------------------------------------
Exception in thread "main" java.lang.StackOverflowError
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
    at java.util.regex.Pattern$Loop.match(Pattern.java:4787)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4719)
.........
    at java.util.regex.Pattern$Branch.match(Pattern.java:4606)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
    at java.util.regex.Pattern$Loop.match(Pattern.java:4787)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4719)
    at java.util.regex.Pattern$BranchConn.match(Pattern.java:4570)

Process finished with exit code 1

Thoughts?

jaymes-bearden commented 5 years ago

Found the issue!

There is a regex used for checking for groups of single quotes (') and double quotes (") with look-ahead. I had a hanging double quote in one of my CSS files.

I debugged this in IntelliJ using stop on Java Exception Breakpoint for StackOverflowError and checking the regex that was used.

@davidB You could probably close this issue.