Friday, August 9, 2013

Resolving IntelliJ Resource Bundle Inspection Errors in Flex Projects

Since switching from FlashBuilder to IntelliJ IDEA (which I’m loving so far) I sometimes come across things that need tweaked a bit. One such thing is inspection errors in the SDK source files where resource bundles are used. Inspection errors don’t necessarily mean that the code won’t compile (although many times it does mean that) but that the IDE can’t make sense of it. In the case of resource bundles, IntelliJ looks for them within source directories, even though they don’t need to exist in source directories to be compiled into the application. Because of this, you often get ugly red marks in your editor when viewing SDK source code.

image

The easy way to remove these inspection errors is to add an SDK classpath pointing to the bundles directory in the Project Structure / SDKs window. In my case, I needed to add a classpath to:
D:\Projects\Flex SDKs\4.10 - AIR 3.8\frameworks\projects\frameworks\bundles

image

2 comments:

  1. Thank you very much for this. I was going crazy with that error mark on every ResourceBundle tag

    ReplyDelete
  2. In our case the resource bundles are located in a library module (e.g. a module called "SharedResources"). So even if the config.xml "additional compiler configuration file" contains the correct path to them for all the other modules using resource bundles, to get rid of the inspection errors we simply had to add a Build Configuration dependency to SharedResources for each other module using resource bundles.

    ReplyDelete