Jakob Külzer Ninja Coding Monkey goes Canada

2Oct/090

Grails GraniteDS Plugin and Flex Modules – Could not resolve ? to a component implementation

I'm currently working a lot with the Grails GraniteDS plugin. Just recently I've started to separate my application into modules and ran into a really nasty error.

It took me some time to figure it out, hopefully I can save you from going through all this.

The Flex web tier compiler usually gives me this error:

Error: Could not resolve <namespace:Component> to a component implementation.

 <namespace:Component/>

error during compilation Could not resolve <namespace:Component> to a component implementation.

Initial research confirmed what I thought, this error is caused by a mismatch between a XML namespace declaration and the actual location of a component. However the location and the namespace declaration looked right and the issue occurred only after I had moved the questionable component into a separate module.

After two painful hours I realized that the Flex webtier compiler, as configured with GraniteDS, resolves namespaces relative to modules, not relative to the source folder. D'oh!

The solution I came up with was simple, might be naïve though. I figured that if resolution is relative to the Module and not to the source folder, there might be no such source folder as I would expect it. A quick look into the flex-config.xml found in <GRAILS_PROJ>/web-app/WEB-INF/flex/flex-config.xml confirmed this:

<!-- List of path elements that form the roots of ActionScript class hierarchies. -->
 <!-- not set -->
 <!--
 <source-path>
 <path-element>string</path-element>
 </source-path>
 -->

So there is no explicit source path set. So I changed it so it would point to <GRAILS_PROJ>/grails-app/views/flex:

<!-- List of path elements that form the roots of ActionScript class hierarchies. -->
 <!-- not set -->
 <source-path>
 <path-element>../../../grails-app/views/flex</path-element>
 </source-path>

Voilá - it works. However, as mentioned earlier, this might be a very limited solution, but for now it works.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.