Ant fileset's "dir" missing from absolute path when using a mapper

Posted by spaaarky21 on Stack Overflow See other posts from Stack Overflow or by spaaarky21
Published on 2011-02-01T04:59:00Z Indexed on 2011/02/01 7:25 UTC
Read the original article Hit count: 322

Filed under:
|
|
|

I've been trying to write an Ant task to "compile" Sass scripts in my project using the apply task but I kept getting a "No such file or directory" error. I thought it might have been caused by spaces in the buildpath so I went through the trouble of moving the project only to find that Ant seems to omitting the fileset's root directory when it returns the path. This is what the target looks like:

<target name="sass-compile" depends="properties">
    <apply executable="sass">
        <srcfile />
        <targetfile />

        <fileset dir="${project.src.dir}" includes="**/*.scss"  />
        <globmapper from="*.scss" to="*.css" />
    </apply>
</target>

To help troubleshoot, I switched the executable from sass to echo and I noticed that the mapper is transforming paths like this...

/Users/me/Documents/Programming/workspace/Project/src/java/com/proj/web/page/template/Template.scss

...into this...

/Users/me/Documents/Programming/workspace/Project/java/com/proj/web/page/template/Template.css

Notice that the src directory is missing from the target file path. Am I seeing a bug here or is this somehow expected? I would love to know what's going on here. I have also tried using a regexpmapper, and a filtermapper with replacestring. The result is the same.

I'm running Ant 1.7.1, which comes bundled with Eclipse Helios, which I'm running on a Mac. I also tried Ant 1.8 on both Mac and Linux. Nothing works. Does anyone have any ideas?

© Stack Overflow or respective owner

Related posts about ant

Related posts about apply