【问题标题】:Getting stackoverflow error while javascript minificationjavascript缩小时出现stackoverflow错误
【发布时间】:2019-01-03 05:36:11
【问题描述】:

我正在开发一个 spring jsp 项目,该项目包含集成在页面上用于客户端脚本的 javascript 文件。我在 pom.xml 的构建标签中使用这个 maven 插件

<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> 

当我最后开始构建过程时,我收到java.lang.StackOverflowError 错误。使用 yuicompressor

【问题讨论】:

    标签: javascript build compression minify yui-compressor


    【解决方案1】:

    在“启动 CSS 任务”和“启动 JavaScript 任务”之后仔细检查 minify 插件的输出是否有意外的文件名。

    未能从缩小中排除某些文件可能会导致此错误。例如:当我的 css 缩小意外包含 js 文件时,我遇到了它,反之亦然。在链接here 的问题中,意外包含了一个 .map 文件。已经缩小的文件也可能导致此问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-27
      • 2019-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多