ant + yuicompressor路径错误 [英] ant + yuicompressor path error
问题描述
我在 C:\ Bin \ test.js 中有一个文件要压缩,并已将其重命名为 test-min.js
I've got a file in C:\Bin\test.js that I would like to compress and have renamed test-min.js
我的蚂蚁 build.xml 看起来像这样:
my ant build.xml looks like this:
<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错误:
I get the following Java error:
[应用] java.io.FileNotFoundException:Bintest-min.js:\ Bin \ test.js (文件名,目录名或卷标签语法不正确)
[apply] java.io.FileNotFoundException: Bintest-min.js:\Bin\test.js (The filename, directory name, or volume label syntax is incorrect)
我已经尝试过可以使用的路径和文件名的所有组合.我想念什么?看起来它正在剥离C:\和第二个\
I've tried every combination of pathing and filenames I could come up with. What am I missing? It looks like it's stripping out C:\ and the second \
我知道YUI可以工作,因为我可以从命令行手动进行操作.
And I know YUI works because I can do it manually from the command line.
推荐答案
升级到yuicompressor 2.4.8后,我遇到了这个问题
I ran into this problem after upgrading to yuicompressor 2.4.8
2.4.8中有一个已知的错误,它不处理ant生成的引用路径.
There is a knows bug in 2.4.8 where it does not handle the quoted paths generated by ant.
回到2.4.7为我解决了该问题.您可以在此处下载2.4.7: https://github.com/yui/yuicompressor/downloads
Going back to 2.4.7 fixed the issue for me. You can download 2.4.7 here: https://github.com/yui/yuicompressor/downloads
您可以在这里找到有关该问题的讨论: http://www.yuiblog.com/blog/2013/05/16/yuicompressor-2-4-8-released/
You can find discussion of the issue here: 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(文件名,目录名或卷标语法不正确)不幸的是,这使它完全无法使用."
"New version 2.4.8 fails to parse Windows filename in quotes correctly. 2.4.7 works fine. Eg, command java -jar yuicompressor-2.4.8.jar "d:\work\common_source.js" –charset utf-8 –disableoptimizations -v -o "d:\work\common.js" gives error java.io.FileNotFoundException: workcommon.js:\work\coomon_source.js (The filename, directory name, or volume label syntax is incorrect). Unfortunately, this renders it entirely unusable."
YUI Compressor缺陷在这里: https://github.com/yui/yuicompressor/issues/78
And the YUI Compressor defect is here: https://github.com/yui/yuicompressor/issues/78
这篇关于ant + yuicompressor路径错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!