Getting stackoverflow error while javascript minification

413 views Asked by At

I am working on a spring jsp project which contains the javascript files integrated on page for client side scripting. I am using this maven plugin inside build tag in pom.xml

<plugin>
        <groupId>com.samaxes.maven</groupId>
        <artifactId>minify-maven-plugin</artifactId>
        <version>1.7.4</version>
        <executions>
            <execution>
                <id>min-js</id>
                <phase>prepare-package</phase>
                <goals>
                    <goal>minify</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <charset>UTF-8</charset>
            <skipMerge>true</skipMerge>
            <cssSourceDir>resources/css/css</cssSourceDir>
            <jsSourceDir>resources/js</jsSourceDir>
            <jsEngine>CLOSURE</jsEngine>
            <closureLanguage>ECMASCRIPT5</closureLanguage>
            <closureAngularPass>true</closureAngularPass>
            <nosuffix>true</nosuffix><webappTargetDir>${project.build.directory}/minify</webappTargetDir>
            <cssSourceIncludes>
                <cssSourceInclude>**/*.css</cssSourceInclude>
            </cssSourceIncludes>
            <cssSourceExcludes>
                <cssSourceExclude>**/*.min.css</cssSourceExclude>
            </cssSourceExcludes>
            <jsSourceIncludes>
                <jsSourceInclude>**/*.js</jsSourceInclude>
            </jsSourceIncludes>
            <jsSourceExcludes>
                <jsSourceExclude>**/*.min.js</jsSourceExclude>
            </jsSourceExcludes>
        </configuration>            </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.4</version>
        <configuration>
            <webResources>
                <resource>
                    <directory>${project.build.directory}/minify</directory>
                </resource>
            </webResources>
        </configuration>
    </plugin> 

When I start to build process at the end I am receiving java.lang.StackOverflowError error. Using yuicompressor

1

There are 1 answers

0
Bampfer On

Check the minify plugin's output carefully for unexpected filenames after "Starting CSS task" and "Starting JavaScript task".

Failing to exclude certain files from the minification can cause this error. For example: I ran into it when my css minification was accidentally including js files, and vice versa. In the issue linked here a .map file was accidentally included. Already minified files might also cause this.