Ant + yuicompressor path error

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

my ant build.xml is as follows:

<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 ( invalid file name, directory or volume name)

I tried every combination of paths and file names that I could think of. What am I missing? It looks like it removes C: \ and the second \

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

+6
source share
2 answers

I ran into this problem after upgrading to yuicompressor 2.4.8

In 2.4.8 there is an error in which it does not handle quoted paths created by ant.

Returning to 2.4.7, I fixed this problem. You can download 2.4.7 here: https://github.com/yui/yuicompressor/downloads

You can find a discussion of the problem here: http://www.yuiblog.com/blog/2013/05/16/yuicompressor-2-4-8-released/

"The new version 2.4.8 does not allow correctly analyzing the Windows file name in quotation marks. 2.4.7 works fine. For example, the command java -jar yuicompressor-2.4.8.jar" d: \ work \ common_source.js "-charset utf -8 -disableoptimizations -v -o "d: \ work \ common.js" gives the error java.io.FileNotFoundException: workcommon.js: \ work \ coomon_source.js (incorrect file name, directory or volume name) Unfortunately, this makes it completely unsuitable. "

And the YUI compressor defect is here: https://github.com/yui/yuicompressor/issues/78

+11
source

I encountered such problems in the past, try / bin

+1
source

Source: https://habr.com/ru/post/950571/


All Articles