12 Replies Latest reply on Jan 22, 2010 2:27 AM by jake_flex

    Help with Flex Ant build.xml error


      So I've started on a new project and I'm new to Flex. A lot of learning curve here. Anyway, I'm trying to deploy a project that uses flex and is built with Ant. We've moving up from a version of Flex 2 to Flex 3. The build file works fine in the Flex 2 app but for some reason does not seem to be working with Flex 3. I'm hoping someone can give me some insight on what might be wrong or where to start.


      The error is Command not found: compc


      The part of the build file it has a problem with is:


      <compc include-classes="${classes}"






      <load_config filename="${FLEX_HOME}/frameworks/flex-config.xml" />

      <source-path path-element="${FLEX_HOME}/frameworks" />

      <source-path path-element="${flex.app.root}" />


      <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">

           <include name="libs" />

           <include name="../bundles/{local}" />



      <compiler.library-path dir="${flex.app.root}" appent="true">

           <include name="libs" />





      Any help at all would be greatly appreciated, thank you.

        • 1. Re: Help with Flex Ant build.xml error
          jake_flex Level 2

          Have you copied the Flex Ant tasks jar to your Ant installation directory?


          Quote from the Flex Ant documentation

          Copy the flex_ant/lib/flexTasks.jar file to Ant's lib directory ({ant_root}/lib).
          If you do not copy this file to the lib directory, you must specify it
          by using Ant's -lib
           option on the command line when you make a project. 


          Have you taken the tasks into use in your build script?


          Quote from the Flex Ant documentation

          Use the Flex tasks in Ant:
          1. Add a new taskdef
           task to your
          project. In this task, specify the flexTasks.tasks file as the
          resource, and point to the flexTasks.jar file for the classpath. For
          <taskdef resource="flexTasks.tasks" classpath="${basedir}/flexTasks/lib/flexTasks.jar" />
          1 person found this helpful
          • 2. Re: Help with Flex Ant build.xml error
            cardician23 Level 1

            Thank you very much for your input. It at least gave me stuff to try as I'm pretty much drowning here trying to even come up with an idea. I did not have the flexTasks.jar in the ant/lib directory, though it was referenced elsewhere in the project with a path. Regardless, I put it there and the specific error I was getting before did change. Now it's getting an error telling me that it can't find the /apps/flex_sdk_340/frameworks directory from the same area of the build file. The problem is that the directory is definitely there and I can cd right to the exact directory it is unable to find.


            Also, there is a taskdef line in the build file, here it is exactly:


            <taskdef classpathref="flex.task.classpath" resource="flexTasks.tasks" />


            and flex.task.classpath eventually defines to a libs directory within the project that contains the build file. This libs directory itself also contains the flexTasks.jar file.


            If anyone has any thoughts as to what else I can try, please let me know. I'm absolutely at a loss for what the problem could be.

            • 3. Re: Help with Flex Ant build.xml error
              jake_flex Level 2

              There seems to be a typo in your compiler.library-path tag. Check the value in red.


              <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">

                   <include name="libs" />

                   <include name="../bundles/{locale}" />



              If that doesn't help. Make sure you are setting the FLEX_HOME variable correctly. The build script you posted does not tell how you are setting this. You could also post the exact error message.

              1 person found this helpful
              • 4. Re: Help with Flex Ant build.xml error
                cardician23 Level 1

                Thank you again. I'm afraid that hasn't yet solved the problem, though perhaps it will have avoided one down the line. Strange though because as I said it worked fine building in a Flex 2 environment. So I'm not so sure that it was a typo. Plus, being in brackets like that, {local}, I thought meant it was a locally defined variable in the build script. Of course I can't find it defined anywhere and I can't find the bundles directory either.


                Regardless though, the exact error I'm now currently getting is:


                Build Failed

                /apps/flex_sdk_340/frameworks not found.


                But I can cd to this exact directory on the server with no problem. So I don't know how the directory could not be found. Obviously the problem is something else that I can't see, probably something stupid. If there is more I can do to help, like post the entire build.xml or something, please let me know. Due to my environment it will take a bit but whatever will help because I have to solve this and still have no ideas.


                Again though, thanks very much for your help.

                • 5. Re: Help with Flex Ant build.xml error
                  jake_flex Level 2

                  Actually I am not sure what is the purpose of '{locale}'. I just compared your build script to mine and noticed that. In my FLEX_HOME/frameworks there's a directory called 'locale' though.


                  I'll ask the same question again. How are you setting the FLEX_HOME variable? Did you change this to point to a different location when switching from Flex 2 to Flex 3?


                  Posting the complete build.xml could help to solve the problem.

                  • 6. Re: Help with Flex Ant build.xml error
                    cardician23 Level 1

                    Sorry, I meant to address that. Yes, since we've moved up to the Flex 3 sdk, we are pointing at a new directory. The old directory was flex_sdk and the new directory is flex_sdk_340.

                    FLEX_HOME is being set in the build.properties file for local building and then overidden in the build.xml file with this code:


                    <target name="build">

                         <available property="FLEX_HOME" value="/apps/flex_sdk_340" file="/apps/flex_sdk_340" />

                         <echo>FLEX_HOME = ${FLEX_HOME}</echo>

                         <antcall target="compile" />



                    I did notice a warning about not using the available property, so I removed it and just changed what FLEX_HOME was set to in the build.properties file to the server directory. Would mess up local building but regardless it didn't matter because it had no effect on the error being generated. I alos looked a little into the file property of the available tag trying to figure out if that was somehow an issue but I wasn't able to come to any conclusion.


                    Before the program errors out, it does displayt he echo statement and the value of FLEX_HOME appears to be correct in that it does show /apps/flex_sdk_340.


                    Thank you so much for your continued help. This is truly frustrating because nothing but a directory name has really changed and yet it stopped working. I can't find any information anywhere on what could be wrong and this is really my last resort.

                    • 7. Re: Help with Flex Ant build.xml error
                      jake_flex Level 2

                      In your original post, you have written


                      <load_config filename="${FLEX_HOME}/frameworks/flex-config.xml" />


                      I don't know whether this is the problem, but it should be


                      <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />


                      There's something wrong with the paths, but it's hard to tell what. These things are really annoying. Try to echo FLEX_HOME in the compile target (the one you make an ant call to). I don't know if ant build scripts have any variable scopes, but you can try this to make sure it's also correctly set later in you script.


                      Also make sure there are no spaces or backslashes('\') in any of your paths, those might cause ant to misbehave.


                      I haven't used the available task with ant, butI checked the documentation and I understand it the same you have written it there, so I can't see any problem there. You could try to set the type as "dir" just to make sure ant is looking for a directory not a file.

                      • 8. Re: Help with Flex Ant build.xml error
                        jake_flex Level 2

                        One more thing.


                        You are using an absolute path to point to FLEX_HOME, is it really physically located in /apps/...? Starting from the root of your file structure?

                        • 9. Re: Help with Flex Ant build.xml error
                          cardician23 Level 1

                          Again, let me thank you for your help. I really do appreciate it.


                          The flex_config thing was just a typo on my part. It is correct in the actual build file.


                          I did finally figure out part of the problem. It turns out that the user running the ant build script did not have full permissions to the directory the flex sdk was in. So it couldn't access /apps/flex_sdk_340/frameworks. One problem out of the way and the build went well for a bit. However, now I'm receiving an error still with compc. The error is:


                          [compc] command line: Error: unknown configuration variable 'load-config /apps/flex_sdk_340/frameworks/flex-config.xml'


                          and then farther down the build fails and tells me


                          compc - Failed with return code: 1


                          Any thoughts on this? I am again baffled because the two build files are basically identical. This is a second flex app within the same project and I have no idea why it's not building. The compc parts are pretty much the same and I have no idea what the error is trying to tell me.

                          • 10. Re: Help with Flex Ant build.xml error
                            jake_flex Level 2

                            Can you post the compc task here as it is on the computer? Copy-paste instead of typing it manually, since there might be some typo or similar error in the script.

                            • 11. Re: Help with Flex Ant build.xml error
                              cardician23 Level 1

                              Oh, wow! It looks like I may have finally managed to get things working...to a point. Apparently the problem had to do with the flexTasks.jar for the particular project not being updated to the newest Flex 3 sdk jar. Instead it was using the flexTasks.jar from an older Flex 2 sdk. Finally it seems that things are starting to build.


                              Of course, now I'm running into a PermGen space error. At least it's something different. Of course this one is being difficult too. I've increased the jvm memory size in the jvm.config file and it seems to have no effect. Not sure what else to try here. If you have any thoughts by all means pass them on. Again, what's really frustrating is the fact that this all worked with flex 2. I changed nothing and now it gets memory heap errors and won't build with flex 3? What sense does that make? *sigh*


                              Anyway, again thanks for all your help and suggestions and at least I've finally moved on to a different problem. Don't know why these things can never be simple. At least for me.

                              • 12. Re: Help with Flex Ant build.xml error
                                jake_flex Level 2

                                I hadn't heard about PermGen error before, so I googled it see what it is.According to the first hits, the only way to fix it is to change/upgrade your JVM. I'd recommend you to get the latest JRE/JDK and try with that. Other than that, I cannot really help.


                                Good luck.