Having trouble with Flex 4.

Hi,

I'm having trouble using Flex 4 with IDEA 9.  I've been trying Flex 4 build 8811 (I use Maven + FlexMojos).  Here's a really simple .mxml file that I'm having trouble with:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                xmlns:x="ca.jptech.itma.flex.core.*"
                width="100%" height="100%"
                paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0">

    <x:CoreImpl width="100%" height="100%"/>

</mx:Application>

When using Flex 3.4 things work as I'd expect.  When using the Flex 4 SDK bundled with Flash Builder beta everything works as I'd expect.  When I switch to Flex 4 via Maven + FlexMojos I get an inspection error:

Element mx:Application must be declared

In .mxml files with more than one namespace it's only the first namespace doesn't seem to work properly.

Any help would be appreciated,
Ryan

11 comments
Comment actions Permalink
  • What is you IDEA version? I recommend one of the latest EAPs: 10666 or 10762.
  • Did I understand your problem correctly: you have Flexmojos project that can be successfully compiled by maven. You've imported it in IDEA using Project Import Wizard (or just 'Open Project' and select pom.xml file). After that IDEA highlights some code (mx:Application tag) as red. Right?
0
Comment actions Permalink

Thanks for the reply.

I have the same issue with both 10666 and 10762.

Yes, you understood my problem correctly.

0
Comment actions Permalink

Hm, the only thing that is needed for <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"/> tag highlighting is the presence of framework.swc file in module dependencies (libraries). In case of maven project import the module library with name "Maven: com.adobe.flex.framework:framework:swc:<Flex SDK version>" must have been created automatically and it must contain file <Maven repo>/com/adobe/flex/framework/framework/<Flex SDK version>/framework-<Flex SDK version>.swc (and of course the file must be present on your computer). Is such library with respective swc file present in your module? Try to reimport project if not. What Flex SDK version is used in this flexmojos project? Please attach your pom.xml if have no idea what is going wrong.

0
Comment actions Permalink

Everything looks correct, but I can't get it to work.  I'll attach a stripped down, single module project that exhibits the behavior.  I use the Sonatype repos for my flex dependencies:

http://repository.sonatype.org/content/groups/flexgroup/

If you're not using something like Nexus as an internal repo you'll have to add the above repo to the pom.

Here's a bit of version info about my environment:

IDEA: 10762
Maven: 2.0.10
FlexSDK (via flexmojos): 4.0.0.8811
Flexmojos: 3.3.0

For me, the attached project will have the 'mx:Application' tag highlighted in the FlexThree.mxml file.  It will also have the 'fx:Script' tag highlighted in the FlexFour.mxml file.  Of note, all of the 'mx' tags work in the FlexFour.mxml file, but aren't recognized in the FlexThree.mxml file.  Let me know if you need any more info.

Ryan

Added a screenshot.



Attachment(s):
itma-flex-core.rar.zip
FlexProblem.jpg
0
Comment actions Permalink

Got it. To have corrrect highlighting (and even compilation by IDEA in the same way as by maven) please do following:

  • Configure flexmojos project to save its compiler configuration report. Just edit pom.xml and add following tag inside <project><build><plugins><plugin><configuration>:

          <configuration>
             <configurationReport>true</configurationReport>
             ...
          </configuration>

  • compile project by maven. File target/xxx-config-report.xml will be created. Don't delete anything from target directory.
  • reimport project in IDEA (in fact it'll be reimported automatically)

After doing that you'll have correct highlighting, IDEA will be able to compile/run/debug your Flex application, run FlexUnit tests by just pressing Ctrl+Shift+F10 at test class/method.

(soon these non-obvious actions will not be necessary, keep in touch with Maia EAPs)

0
Comment actions Permalink

Hi Alexander,

Sorry for the slow reply.  Adding <configurationReport>true</configurationReport> to my pom doesn't seem to help.  Using Flex SDK 4.0.0.8811 (from flexmojos) I've tried with IDEA versions 8.1.3, 10633, and 10762.  I've also tried with Flex SDK 4.0.0.10163 and IDEA 10762.  File target/xxx-config-report.xml is created, but doesn't seem to have any impact.  I've done most of my testing with the sample project I attached earlier.

Ryan

0
Comment actions Permalink

As for IDEA 8.1.3 - the process is a bit different there: http://blogs.jetbrains.com/idea/2009/08/flexmojos-in-dian/

As for Maia 10666 and 10762. I have taken your project. Added <configurationReport> tag. Ran 'mvn compile' from command line. Clicked File -> Open Project in IDEA and selected pom.xml. And finally had all correct highlighting. Please make sure that 'Use custom compiler configuration file' is checked and xxx-config-report.xml is selected at Flex facet tab in Project Structure dialog. (In case of IDEA 10666 make sure that 'Use default SDK compiler configuration file' is unchecked).

Ufortunately due to Flex SDK bug (http://bugs.adobe.com/jira/browse/SDK-22882) you'll not be able to compile your project using Flex SDK 4.0.0 of builds since 8553 till 10128. So with SDK 8811 you will have only highlighting, but with SDK 10163 - compilation as well.

0
Comment actions Permalink

My facets did not have 'use a custom compiler configuration file' checked.  I really appreciate the help, so I took a few minutes and added a page to the FlexMojos wiki (https://docs.sonatype.org/display/FLEXMOJOS/Tips+for+using+FlexMojos+with+IntelliJ+IDEA).

Thank you,
Ryan

0
Comment actions Permalink

Thank you very much for this wiki page!
One thing that may not be obvious for readers is that flexmojos project must be imported to IDEA. I suggest to add something like this before "In IDEA make sure each Flex facet..." line:

  • Import Flexmojos project to IDEA: click Open Project on the File menu and select your pom.xml. If the project was already imported it will reimort automatically when pom.xml changes.
0
Comment actions Permalink

Enjoy!
http://blogs.jetbrains.com/idea/2009/09/flexmojos-inmaia/
(described functionality will appear in the next Maia EAP, can't say its exact build number now)

Can you please add a link to this post at your flexmojos wiki page?

0
Comment actions Permalink

Added!

The FlexMojos / Maven support in IDEA 9 EAP is truly remarkable.

I'm finally to the point where I'm satisfied with the platform I've built and IDEA + FlexMojos + Maven + TeamCity really make it shine.  So far I have a dozen or so modules including EJBs + Java DTOs + ActionScript DTOs + BlazeDS + SWCs + SWFs + WAR assembly + EAR assembly + Install4J assembly + AIR assembly.

I can check the whole thing out from SVN, open the main project POM in IDEA and I'm literally writing productive code in about 2 minutes.  Everything 'just works' and I get to spend my time developing rather than configuring.  I check things back in to SVN and TeamCity spits out a couple desktop installers and auto-deploys the EAR to a test server.

I develop with pleasure AND a gigantic smile every single day!  That is, until I develop my 20th module ;-)

Ryan

0

Please sign in to leave a comment.