3 Replies Latest reply on Dec 14, 2010 6:19 AM by marcesher

    mxmlc Ant Task Paths

    chris00chris Level 1



      I'm trying to run the following mxmlc ant task from a relative path:




      If I run the task from within the MyApp directory it works fine, but I want to run it from a relative directory, eg:


              ant -f MyApp/build.xml


      or from an ant build file:


              <ant dir="MyApp"/>


      However, in both cases I just get the following error:


              [mxmlc] command line: Error: unable to open 'web/WEB-INF/flex/services-config.xml'


      I really need to use relative paths as it is running as a sub-project of a larger project via an ant build, and there is no concept of changing directories within ant.


      Does anybody know how I can get relative paths to works?



        • 1. Re: mxmlc Ant Task Paths


          I'm not sure if that is what you are after or not... but anyway...

          We don't use relative paths, but instead we obtain the folder the ant file lives in, stick it in a property, and then prepend that to any path. The paths then become something like:




          We end up with th convenience of relative paths and the ability to run scripts from different locations.

          Hope that helps.




          • 2. Re: mxmlc Ant Task Paths
            chris00chris Level 1

            Thanks. That's what I ended up doing in the end. I also added (prior to that)


            <property name="project.dir" value="."/>


            So that it can be run without manually specifying project.dir. (project.dir will only be set to . if it is not already set by an outer script).


            What I really wanted was for mxmlc to run relative to the ant task, eg.


            <ant dir="project"/>


            Then each task inside the ant build file should run relative to "project". This is how <javac/> works. I don't think Adobe like relative paths though.

            • 3. Re: mxmlc Ant Task Paths
              marcesher Level 1

              If you use


              <property name="dir" location="../../whatever" />


              That will create a path relative to the ant file... well, technically, it'll be relative to whatever the "basedir" setting in the <project> element is.