java - ant + yuicompressor路径错误

标签 java ant yui-compressor

我在 C:\Bin\test.js 中有一个文件,我想将其压缩并重命名为 test-min.js

我的 Ant build.xml 看起来像这样:

<property name="temp.dir" value="C:\Bin\"/>

<apply executable="java" parallel="false" dest="${temp.dir}">
   <fileset dir="${temp.dir}" includes="test.js"/>
   <arg line="-jar"/>
   <arg path="${yui.dir}"/>
   <srcfile/>
   <arg line="-o"/>
   <mapper type="glob" from="*.js" to="*-min.js"/>
   <targetfile/>
</apply>

我收到以下 Java 错误:

[应用] java.io.FileNotFoundException: Bintest-min.js:\Bin\test.js(文件名、目录名或卷标语法不正确)

我已经尝试了所有我能想出的路径和文件名组合。我错过了什么?看起来它正在剥离 C:\和第二个\

我知道 YUI 可以工作,因为我可以从命令行手动完成它。

最佳答案

我升级到yuicompressor 2.4.8后遇到了这个问题

2.4.8 中有一个已知错误,它不处理由 ant 生成的引用路径。

回到 2.4.7 为我解决了这个问题。您可以在此处下载 2.4.7: https://github.com/yui/yuicompressor/downloads

您可以在此处找到对该问题的讨论: http://www.yuiblog.com/blog/2013/05/16/yuicompressor-2-4-8-released/

“新版本 2.4.8 无法正确解析引号中的 Windows 文件名。2.4.7 工作正常。例如,命令 java -jar yuicompressor-2.4.8.jar “d:\work\common_source.js” –charset utf -8 –disableoptimizations -v -o “d:\work\common.js” 给出错误 java.io.FileNotFoundException: workcommon.js:\work\coomon_source.js(文件名、目录名或卷标语法不正确) .不幸的是,这使它完全无法使用。”

YUI Compressor 的缺陷在这里: https://github.com/yui/yuicompressor/issues/78

关于java - ant + yuicompressor路径错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17932315/

相关文章:

ant - Ant如何代理Windows环境变量

regex - sed 正则表达式修复 css 缩小

Javascript 压缩和对象属性问题

Java - 循环遍历数据库记录的有效方法

Java斯坦福NLP : Spell checking

java - 智能 : Is there an Intention Action to convert old style Log4J calls to new style SLF4J calls?

ant - 无法解析 IntelliJ IDEA 11 Ant 构建脚本中的符号 'scp'

ant - 如果 Ant 中 undefined variable ,则引发错误

视频末尾的 Java .mp4 流损坏 - 网络错误

debugging - 告诉 YUI 压缩器保留我的调试器;声明