我想将多个 js 文件聚合/组装成一个,而不使用 maven 插件缩小或混淆它们。
我已经在使用 yui 插件将一些 js 文件混淆成一个:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>obfuscate</id>
<phase>process-resources</phase>
<goals>
<goal>compress</goal>
</goals>
<configuration>
<nosuffix>true</nosuffix>
<linebreakpos>-1</linebreakpos>
<aggregations>
<aggregation>
<removeIncluded>true</removeIncluded>
<insertNewLine>false</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/all.js</output>
<includes>
<include>**/*.js</include>
</includes>
<excludes>
<exclude>**/include/*.js</exclude>
</excludes>
</aggregation>
</aggregations>
</configuration>
</execution>
</executions>
</plugin>
现在 我希望在文件 allForDev.js 中聚合相同的 js 文件而不进行缩小或混淆.目标是拥有一份用于开发的文件和一份用于生产的文件。在开发人员工具中调试时查看整个脚本会很有用。如果我找不到办法做到这一点,我将被迫放置大量脚本标签来加载所有这些脚本(这不是世界末日:),但我想以更简洁的方式进行)。
我可以看到 assemble 插件具有以下格式:
zip tar.gz tar.bz2 jar dir war and any other format that the ArchiveManager has been configured for
有没有办法可以使用 assemble maven 插件来做到这一点? 正如我所看到的,有很多示例可以创建 zips jars 和 wars,但没有一个与我想做的事情相匹配。还是我错过了什么?
我可以使用另一个插件吗?
作为旁注,我尝试使用 yui 插件的第二次执行来创建第二个 js 文件,但我没有成功创建 2 个文件。我还尝试提供 2 个 yui 插件,但再次失败。我认为这也是不可能的。
干杯,
暴君
最佳答案
答案就在 wro4j 库中。有关更精确的设置,请参阅:
Javascript and CSS files combining in Maven build WITHOUT compression, minification etc
关于maven-plugin - 使用 Maven 插件将多个(js)文件聚合/组装成一个(js)文件而不压缩的最简单方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13294677/