9 Replies Latest reply on Jun 18, 2010 10:07 AM by Abram Adams

    Bad news if I can't debug cfcs in a flex project

    nikos101 Level 2

      I'm trying to debug a cfc in a flex project Coldfusion builder installed as a plugin is Flash builder 4

       

      But I'm getting a message saying:

       

      File does not belong to a coldfusion project. Apply Coldfusion nature to the project to which the file belongs.

       

      This is bad news if I can't debug cfcs in a flex project

        • 1. Re: Bad news if I can't debug cfcs in a flex project
          Lampei Level 1

          Just trying to understand this, but why do you have ColdFusion CFCs within a Flex project?  Your Flex project is compiled and will live client side, while your ColdFusion CFCs are going to live on the server.

          1 person found this helpful
          • 2. Re: Bad news if I can't debug cfcs in a flex project
            nikos101 Level 2

            Because the cfcs are specific to the flex project, I like having all my files that relate to an application in a single flex project.

            • 3. Re: Bad news if I can't debug cfcs in a flex project
              Abram Adams Level 1

              Personally I'd keep them as separate projects.  You can still have both projects opened in eclipse and it will choose the proper editor when you open an .mxml/as vs .cfc/cfm file.

               

              I'm actually developing a project now that embeds Railo into my Flex/Air app (to take my cf apps offline) so I have CFML that lives inside the packaged air application.  Even in this situation I keep them separate and use a custom ant build to export my CF project (from svn) to the appropriate directory in my Flex/Air project.

              • 4. Re: Bad news if I can't debug cfcs in a flex project
                nikos101 Level 2

                I think your right mate, its taking me 5 programming years to figure this out


                • 5. Re: Bad news if I can't debug cfcs in a flex project
                  nikos101 Level 2

                  can you share your ant build?


                  • 6. Re: Bad news if I can't debug cfcs in a flex project
                    Abram Adams Level 1

                    Here are the targets (simplified) that are specific to the cfml export.  The real build.xml reads a build.properties file for the variables, and main runs the flex build first:

                     

                    <!-- Refresh CFML -->
                    
                    <property name="SVN.USERNAME" value="MY SVN USERNAME"/><!-- change to your svn username -->
                    <property name="SVN.PASSWORD" value="MY SVN PASSWORD"/><!-- change to your svn password -->
                    <property name="SVN.PROJECT_URL" value="http://mysvnproject.com/trunk"/><!-- change to your svn url -->
                    <property name="BUILD.EXPORT_DIR" value="c:/CFML/project/export/path"/><!-- change to your CFML project path -->
                    <property name="DEPLOY_DIR" value="c:/flex/project/deploy/path"/><!-- change to your Flex project path -->
                    
                    <!-- runs the targets -->
                    <target name="main" depends="export-cfml, copy-cfml"/>
                    
                    <target name="export-cfml" depends="find_revision, check-svn-build" unless="build.exists">
                         <echo>Lates SVN build did not exist, export it</echo>
                         <!-- export from svn -->
                         <exec executable="svn">
                              <arg line="export &quot;${SVN.PROJECT_URL}&quot; ${build.dir} -r ${revision.number} --username ${SVN.USERNAME} --password ${SVN.PASSWORD}"/>
                         </exec>          
                    </target>
                    
                    
                    <!-- Get the latest revision number -->
                    <target name="find_revision" description="Sets property 'revision.number' to the head svn revision">
                         
                         <!-- Use SVN to learn the latest revision number -->
                         <exec executable="svn" outputproperty="revision.number">
                              <arg line="info &quot;${SVN.PROJECT_URL}&quot;"/>
                              <redirector>
                                   <outputfilterchain>
                                        <linecontainsregexp>
                                             <regexp pattern='^Last Changed Rev' />
                                        </linecontainsregexp>
                                        <tokenfilter>
                                             <replaceregex pattern='[\D]+([\d]+)' replace="\1" />
                                        </tokenfilter>
                                   </outputfilterchain>
                              </redirector>
                         </exec>
                         <echo message="Current SVN Revision: ${revision.number}"/>
                    </target>
                    
                    <!-- we only export from svn if we haven't already for current revision.number -->
                    <target name="check-svn-build">
                         <!-- setup the build dir name based on the latest revision number -->
                         <property name="build.dir" value="${BUILD.EXPORT_DIR}/${revision.number}" />
                         <available file="${build.dir}" property="build.exists" value="true" type="dir" />
                         <echo>SVN build exists: ${build.exists}</echo>
                    </target>
                    
                    <!-- we always copy from the latest svn export dir to the flex project -->
                    <target name="copy-cfml">
                         <echo>Copy CFML to Flex Project</echo>
                         <!-- copy cfml to flex project -->
                         <copy todir="${DEPLOY_DIR}/www">
                              <fileset dir="${build.dir}"/>
                         </copy>
                    </target>
                    

                    Note: I quickly stripped out all "extra" stuff we do for our project, so this is untested and may contain typos.

                    1 person found this helpful
                    • 7. Re: Bad news if I can't debug cfcs in a flex project
                      nikos101 Level 2

                      Thats nice because I find it easier to have my cfcs locally for svn backup then deploy them

                      to network for testing.


                      • 8. Re: Bad news if I can't debug cfcs in a flex project
                        nikos101 Level 2

                        How do you define the location of the svn executable?

                         

                        It looks as if you are saving the air code in a different location to the coldfusion code?

                         

                        cheers and respect

                        • 9. Re: Bad news if I can't debug cfcs in a flex project
                          Abram Adams Level 1

                          I'm using the CollabNet Subversion Client, which when installed adds the binary's path to the windows %PATH% environment variable.  Therefore the:

                          <exec executable="svn" 

                          just knows where it is.  You could set that up as a property just as easy though.

                           

                          It looks as if you are saving the air code in a different location to the coldfusion code?

                          I have my CFML and Flex/Air projects in two separate directories.  The svn task exports the latest version of the CFML code to a folder where I keep all exported builds (based on a milestone + build number naming convention).  Once exported, ant then copies the CFML into my Air project release path.  So ultimately they live together.