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

    mxmlc Ant Task Paths

    chris00chris

      Hello,

       

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

       

              <mxmlc
                  file="flx/MyApp.mxml"
                  output="web/MyApp.swf"
                  context-root="MyApp"
                  services="web/WEB-INF/flex/services-config.xml"
                  compatibility-version="3">
                  <source-path
                      path-element="flx"/>
              </mxmlc>

       

      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?

       

      Thanks

        • 1. Re: mxmlc Ant Task Paths
          serwylo

          G'day,


          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:

           

          "${project.dir}/web/WEB-INF/flex/services-config.xml"

           

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

          Hope that helps.

           

          cheers,

          pete.

          • 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

              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.