7

I've got a file in C:\Bin\test.js that I would like to compress and have renamed test-min.js

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>

I get the following Java error:

[apply] java.io.FileNotFoundException: Bintest-min.js:\Bin\test.js (The filename, directory name, or volume label syntax is incorrect)

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 \

And I know YUI works because I can do it manually from the command line.

4

2 回答 2

12

我升级到 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

于 2013-10-12T21:17:04.940 回答
1

我过去遇到过这类问题,试试 /Bin

于 2013-07-29T19:30:20.247 回答