ant + yuicompressor 路径错误 [英] ant + yuicompressor path error

查看:24
本文介绍了ant + yuicompressor 路径错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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:

[apply] 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 有一个已知的 bug,它不处理 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆