[forge-dev] automatic dependency detection too restrictive?

Thomas Frühbeck fruehbeck at aon.at
Fri Feb 17 14:08:47 EST 2012

Am 15.02.2012 16:03, schrieb Lincoln Baxter, III:
> I just had a thought. Are you sure that you really need the MVEL 
> library? Is it possible that you are directly referencing MVEL classes 
> when you should instead be referencing Seam Render classes?
> "TemplateCompiler" comes to mind.
Lincoln you were right, the issue is in fact related to TemplateCompiler 
but not directly.
I think I understand the problem now in detail and want to propose a 
solution. As my code was just taken from the FacesScaffold I did not 
further think about using it.
As it turns out my plugin is not "as privileged?" as the FacesScaffold, 
so the problem became visible with my implementation.

Situation: the FacesScaffold wants to calculate the textual indentation 
for the metawidgets that will be rendered inside of a template.
To access the _compiled_ template, which seams to show the real 
indentation level, the following code was executed:

     private org.jboss.seam.render.template.CompiledTemplateResource 
          String template = 

Now there is the hidden access to the MVEL libraries, because 
CompiledTemplateResource.getTemplate() will return a native 
This is _very_ unfortunate, because there seems to be no easy way to 
e.g. override getTemplate() because it is already in the seam.render libs.
On the other side it is quite important to provide consistent 
indentation for the generated sources - it simply looks ugly and unprof 
if code goes zigzag.

My proposed solution is to provide a TemplateConverter in the 
scaffold.faces plugin. There the visibility of MVEL is provided and so 
does not conflict with forge's libs.
On the other hand the FacesScaffold classes are visible to the other 

package org.jboss.forge.scaffold.faces;

public class TemplateConverter {

     public String convert(CompiledTemplateResource resource) {
         return new String(resource.getCompiledTemplate().getTemplate());

So now I can convert the compiled templates by :
    private TemplateConverter templateConverter;
    String template = templateConverter.convert(this.backingBeanTemplate);

I would be very glad to provide the pull.request for this class.
Any recommendations for the solution or the destination package for the 


More information about the forge-dev mailing list