Author: nbelaevski
Date: 2009-08-13 10:27:45 -0400 (Thu, 13 Aug 2009)
New Revision: 15168
Added:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenVelocityCompilationContext.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/BuildLibraryMojo.java
Modified:
root/cdk/trunk/plugins/annotations/
root/cdk/trunk/plugins/generator/
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/BaseTagBodyConsumer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/BaseTemplateConsumer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/ChooseTagBodyConsumer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/StructuralTagBodyConsumer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/TemplateBodyConsumer.java
root/cdk/trunk/plugins/generator/src/main/xsd/cdk-template.xsd
root/cdk/trunk/plugins/generator/src/main/xsd/xhtml-el.xsd
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java
Log:
Fixed for template compiler
Mojo for template compiler
Property changes on: root/cdk/trunk/plugins/annotations
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Property changes on: root/cdk/trunk/plugins/generator
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
.classpath
.clover
+ target
.settings
.project
.classpath
.clover
bin
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/BaseTagBodyConsumer.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/BaseTagBodyConsumer.java 2009-08-13
13:12:36 UTC (rev 15167)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/BaseTagBodyConsumer.java 2009-08-13
14:27:45 UTC (rev 15168)
@@ -58,13 +58,16 @@
MethodBodyStatement ifStatement = createIfExpression(startElement);
statement.addToBody(ifStatement);
- return new BaseTagBodyConsumer(ifStatement);
+ return new StructuralTagBodyConsumer(ifStatement);
} else if ("choose".equals(name.getLocalPart())) {
MethodBodyStatement whenStatement = new MethodBodyStatement();
statement.addToBody(whenStatement);
return new ChooseTagBodyConsumer(whenStatement);
+ } else if ("call".equals(name.getLocalPart())) {
+ statement.addToBody(createCallExpression(startElement));
+ } else {
+ throw new IllegalArgumentException();
}
-
} else {
statement.addToBody(createStartElement(startElement));
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/BaseTemplateConsumer.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/BaseTemplateConsumer.java 2009-08-13
13:12:36 UTC (rev 15167)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/BaseTemplateConsumer.java 2009-08-13
14:27:45 UTC (rev 15168)
@@ -302,4 +302,10 @@
return new MethodBodyStatement(MessageFormat.format("return {0}.class;",
componentClassName));
}
+ protected MethodBodyStatement createCallExpression(StartElement startElement) {
+ Attribute expressionAttribute = startElement.getAttributeByName(new
QName("expression"));
+ String expressionValue = expressionAttribute.getValue();
+ return new MethodBodyStatement(expressionValue);
+ }
+
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/ChooseTagBodyConsumer.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/ChooseTagBodyConsumer.java 2009-08-13
13:12:36 UTC (rev 15167)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/ChooseTagBodyConsumer.java 2009-08-13
14:27:45 UTC (rev 15168)
@@ -69,7 +69,7 @@
statement.addToBody(bodyStatement);
statements.add(bodyStatement);
- return new BaseTagBodyConsumer(bodyStatement);
+ return new StructuralTagBodyConsumer(bodyStatement);
} else {
throw new IllegalArgumentException();
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/StructuralTagBodyConsumer.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/StructuralTagBodyConsumer.java 2009-08-13
13:12:36 UTC (rev 15167)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/StructuralTagBodyConsumer.java 2009-08-13
14:27:45 UTC (rev 15168)
@@ -20,8 +20,6 @@
*/
package org.richfaces.builder.templates;
import javax.xml.namespace.QName;
-import javax.xml.stream.events.Characters;
-import javax.xml.stream.events.EndElement;
import javax.xml.stream.events.StartElement;
import org.richfaces.builder.model.MethodBodyStatement;
@@ -30,46 +28,20 @@
* @author Nick Belaevski
*
*/
-public class StructuralTagBodyConsumer extends BaseTemplateConsumer {
+public class StructuralTagBodyConsumer extends BaseTagBodyConsumer {
- private MethodBodyStatement statement;
-
public StructuralTagBodyConsumer(MethodBodyStatement methodBodyStatement) {
- super();
-
- this.statement = methodBodyStatement;
+ super(methodBodyStatement);
}
@Override
- public void consumeCharacters(Characters characters) {
- String trimmedText = characters.getData().trim();
-
- if (trimmedText.length() != 0) {
- statement.addToBody(createWriteText(characters));
- }
- }
-
- @Override
- public void consumeEndElement(EndElement endElement) {
- QName name = endElement.getName();
-
- if (isCdkNamespace(name) && name.getLocalPart().equals("body")) {
- throw new IllegalArgumentException();
- } else {
- statement.addToBody(createEndElement(endElement));
- }
- }
-
- @Override
public Consumer consumeStartElement(StartElement startElement) {
QName name = startElement.getName();
- if (isCdkNamespace(name) && name.getLocalPart().equals("body")) {
+ if (isCdkNamespace(name)&& name.getLocalPart().equals("body")) {
throw new IllegalArgumentException();
} else {
- statement.addToBody(createStartElement(startElement));
+ return super.consumeStartElement(startElement);
}
-
- return this;
}
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/TemplateBodyConsumer.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/TemplateBodyConsumer.java 2009-08-13
13:12:36 UTC (rev 15167)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/builder/templates/TemplateBodyConsumer.java 2009-08-13
14:27:45 UTC (rev 15168)
@@ -7,6 +7,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.xml.namespace.QName;
+import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.Characters;
import javax.xml.stream.events.EndElement;
import javax.xml.stream.events.StartElement;
@@ -116,6 +117,8 @@
MethodBodyStatement chooseStatement = new MethodBodyStatement();
statements.add(chooseStatement);
return new ChooseTagBodyConsumer(chooseStatement);
+ } else if ("call".equals(name.getLocalPart())) {
+ statements.add(createCallExpression(startElement));
}
} else {
statements.add(createStartElement(startElement));
Modified: root/cdk/trunk/plugins/generator/src/main/xsd/cdk-template.xsd
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/xsd/cdk-template.xsd 2009-08-13 13:12:36 UTC
(rev 15167)
+++ root/cdk/trunk/plugins/generator/src/main/xsd/cdk-template.xsd 2009-08-13 14:27:45 UTC
(rev 15168)
@@ -50,6 +50,7 @@
</xs:element>
<xs:element ref="if" />
<xs:element ref="choose" />
+ <xs:element ref="call" />
</xs:choice>
</xs:group>
@@ -87,4 +88,9 @@
</xs:sequence>
</xs:complexType>
</xs:element>
+ <xs:element name="call">
+ <xs:complexType>
+ <xs:attribute name="expression" form="unqualified" />
+ </xs:complexType>
+ </xs:element>
</xs:schema>
Modified: root/cdk/trunk/plugins/generator/src/main/xsd/xhtml-el.xsd
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/xsd/xhtml-el.xsd 2009-08-13 13:12:36 UTC
(rev 15167)
+++ root/cdk/trunk/plugins/generator/src/main/xsd/xhtml-el.xsd 2009-08-13 14:27:45 UTC
(rev 15168)
@@ -2694,6 +2694,7 @@
</xs:group>
<xs:complexType name="area.content">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attributeGroup ref="attrs"></xs:attributeGroup>
<xs:attributeGroup ref="focus"></xs:attributeGroup>
<xs:attribute default="rect" name="shape"
type="Shape"></xs:attribute>
@@ -2718,12 +2719,14 @@
<xs:attributeGroup ref="cdk:core.attrs" />
</xs:complexType>
<xs:complexType name="base.content">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attribute name="id" type="ID"></xs:attribute>
<xs:attribute name="href" type="URI"></xs:attribute>
<xs:attribute name="target"
type="FrameTarget"></xs:attribute>
<xs:attributeGroup ref="cdk:core.attrs" />
</xs:complexType>
<xs:complexType name="basefont.content">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attribute name="id" type="ID" />
<xs:attribute use="required" name="size"
type="xs:anySimpleType" />
<xs:attribute name="color" type="Color" />
@@ -2731,6 +2734,7 @@
<xs:attributeGroup ref="cdk:core.attrs" />
</xs:complexType>
<xs:complexType name="br.content">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attributeGroup ref="coreattrs"></xs:attributeGroup>
<xs:attribute default="none" name="clear">
<xs:simpleType>
@@ -2752,6 +2756,7 @@
<xs:attributeGroup ref="cdk:core.attrs" />
</xs:complexType>
<xs:complexType name="col.content">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attributeGroup ref="attrs"></xs:attributeGroup>
<xs:attribute default="1" name="span"
type="Number"></xs:attribute>
<xs:attribute name="width"
type="MultiLength"></xs:attribute>
@@ -2911,6 +2916,7 @@
</xs:sequence>
</xs:group>
<xs:complexType name="img.content">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attributeGroup ref="attrs"></xs:attributeGroup>
<xs:attribute use="required" name="src"
type="URI"></xs:attribute>
<xs:attribute use="required" name="alt"
type="Text"></xs:attribute>
@@ -2942,6 +2948,7 @@
<xs:attributeGroup ref="cdk:core.attrs" />
</xs:complexType>
<xs:complexType name="input.content">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attributeGroup ref="attrs"></xs:attributeGroup>
<xs:attributeGroup ref="focus"></xs:attributeGroup>
<xs:attribute default="text" name="type"
type="InputType"></xs:attribute>
@@ -2964,12 +2971,14 @@
<xs:attributeGroup ref="cdk:core.attrs" />
</xs:complexType>
<xs:complexType name="isindex.content">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attributeGroup ref="coreattrs"></xs:attributeGroup>
<xs:attributeGroup ref="i18n"></xs:attributeGroup>
<xs:attribute name="prompt"
type="Text"></xs:attribute>
<xs:attributeGroup ref="cdk:core.attrs" />
</xs:complexType>
<xs:complexType name="link.content">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attributeGroup ref="attrs"></xs:attributeGroup>
<xs:attribute name="charset"
type="Charset"></xs:attribute>
<xs:attribute name="href" type="URI"></xs:attribute>
@@ -3027,6 +3036,7 @@
</xs:group>
<xs:complexType name="meta.content">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attributeGroup ref="i18n"></xs:attributeGroup>
<xs:attribute name="id" type="ID"></xs:attribute>
<xs:attribute name="http-equiv"
type="xs:anySimpleType"></xs:attribute>
@@ -3124,6 +3134,7 @@
</xs:group>
<xs:complexType name="option.content" mixed="true">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attributeGroup ref="attrs"></xs:attributeGroup>
<xs:attribute name="selected">
<xs:simpleType>
@@ -3145,6 +3156,7 @@
<xs:attributeGroup ref="cdk:core.attrs" />
</xs:complexType>
<xs:complexType name="param.content">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attribute name="id" type="ID"></xs:attribute>
<xs:attribute use="required" name="name"
type="xs:anySimpleType">
</xs:attribute>
@@ -3230,6 +3242,7 @@
</xs:group>
<xs:complexType name="style.content" mixed="true">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attributeGroup ref="i18n"></xs:attributeGroup>
<xs:attribute name="id" type="ID"></xs:attribute>
<xs:attribute use="required" name="type"
type="ContentType"></xs:attribute>
@@ -3332,6 +3345,7 @@
</xs:choice>
</xs:group>
<xs:complexType name="title.content" mixed="true">
+ <xs:group ref="cdk:structural" minOccurs="0"
maxOccurs="unbounded" />
<xs:attributeGroup ref="i18n"></xs:attributeGroup>
<xs:attribute name="id" type="ID"></xs:attribute>
<xs:attributeGroup ref="cdk:core.attrs" />
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java 2009-08-13
13:12:36 UTC (rev 15167)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java 2009-08-13
14:27:45 UTC (rev 15168)
@@ -21,12 +21,7 @@
package org.richfaces.builder.maven;
-import org.apache.velocity.Template;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
import org.richfaces.cdk.AbstractCdkContext;
-import org.richfaces.cdk.CdkException;
/**
* @author shura
@@ -35,16 +30,14 @@
public class MavenCompilationContext extends AbstractCdkContext {
private MavenLogger logger;
- private VelocityEngine engine;
/**
* @param logger
* @throws CompilationException
*/
- public MavenCompilationContext(MavenLogger logger,ClassLoader loader,VelocityEngine
engine) {
+ public MavenCompilationContext(MavenLogger logger, ClassLoader loader) {
super(loader);
this.logger = logger;
- this.engine = engine;
}
/* (non-Javadoc)
@@ -103,20 +96,4 @@
logger.warn(content, error);
}
-
- /* (non-Javadoc)
- * @see
org.richfaces.templatecompiler.builder.CompilationContext#getTemplate(java.lang.String)
- */
- public Template getTemplate(String name) throws CdkException {
- try {
- return engine.getTemplate(name);
- } catch (ResourceNotFoundException e) {
- throw new CdkException(e.getLocalizedMessage());
- } catch (ParseErrorException e) {
- throw new CdkException(e.getLocalizedMessage());
- } catch (Exception e) {
- throw new CdkException(e.getLocalizedMessage());
- }
- }
-
}
Added:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenVelocityCompilationContext.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenVelocityCompilationContext.java
(rev 0)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenVelocityCompilationContext.java 2009-08-13
14:27:45 UTC (rev 15168)
@@ -0,0 +1,58 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.builder.maven;
+
+import org.apache.velocity.Template;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.richfaces.cdk.CdkException;
+
+/**
+ * @author shura
+ *
+ */
+public class MavenVelocityCompilationContext extends MavenCompilationContext {
+
+ private VelocityEngine engine;
+
+ public MavenVelocityCompilationContext(MavenLogger logger,ClassLoader
loader,VelocityEngine engine) {
+ super(logger, loader);
+ this.engine = engine;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.richfaces.templatecompiler.builder.CompilationContext#getTemplate(java.lang.String)
+ */
+ public Template getTemplate(String name) throws CdkException {
+ try {
+ return engine.getTemplate(name);
+ } catch (ResourceNotFoundException e) {
+ throw new CdkException(e.getLocalizedMessage());
+ } catch (ParseErrorException e) {
+ throw new CdkException(e.getLocalizedMessage());
+ } catch (Exception e) {
+ throw new CdkException(e.getLocalizedMessage());
+ }
+ }
+
+}
Added:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/BuildLibraryMojo.java
===================================================================
---
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/BuildLibraryMojo.java
(rev 0)
+++
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/BuildLibraryMojo.java 2009-08-13
14:27:45 UTC (rev 15168)
@@ -0,0 +1,145 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.builder.mojo;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.PrintWriter;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.richfaces.builder.model.JavaClass;
+import org.richfaces.builder.render.JavaClassRenderer;
+import org.richfaces.builder.templates.TemplateReader;
+
+/**
+ * @author Nick Belaevski
+ * @goal build
+ */
+public class BuildLibraryMojo extends AbstractCDKMojo {
+
+ /**
+ * templatesDirectory
+ * @parameter expression="${basedir}/src/main/templates"
+ */
+ private File templatesDirectory;
+
+ /**
+ * sourceFileIncludes
+ * @parameter
+ */
+ private String[] templateFileIncludes = {"**/*.template.xml"};
+
+ /**
+ * sourceFileExcludes
+ * @parameter
+ */
+ private String[] templatesFileExcludes = null;
+
+ /**
+ * @param templatesDirectory the templatesDirectory to set
+ */
+ public void setTemplatesDirectory(File templatesDirectory) {
+ this.templatesDirectory = templatesDirectory;
+ }
+
+ /**
+ * @param templateFileIncludes the templateFileIncludes to set
+ */
+ public void setTemplateFileIncludes(String[] templateFileIncludes) {
+ this.templateFileIncludes = templateFileIncludes;
+ }
+
+ /**
+ * @param templatesFileExcludes the templatesFileExcludes to set
+ */
+ public void setTemplatesFileExcludes(String[] templatesFileExcludes) {
+ this.templatesFileExcludes = templatesFileExcludes;
+ }
+
+ private String[] doScan(String[] includes, String[] excludes, File rootFolder)
+ throws MojoExecutionException {
+ try {
+ DirectoryScanner directoryScanner = new DirectoryScanner();
+ directoryScanner.setFollowSymlinks(true);
+ directoryScanner.setBasedir(rootFolder);
+ directoryScanner.setExcludes(excludes);
+ directoryScanner.setIncludes(includes);
+ directoryScanner.addDefaultExcludes();
+
+ directoryScanner.scan();
+
+ return directoryScanner.getIncludedFiles();
+ } catch (IllegalStateException e) {
+ throw new MojoExecutionException(
+ "Error scanning source root: \'" + rootFolder +
"\'", e );
+ }
+ }
+
+ private Iterable<File> findTemplateFiles() throws MojoExecutionException {
+ Set<File> sourceFiles = new HashSet<File>();
+ if (templatesDirectory.exists() && templatesDirectory.isDirectory()) {
+ for (String fileName : doScan(templateFileIncludes, templatesFileExcludes,
templatesDirectory)) {
+ sourceFiles.add(new File(templatesDirectory, fileName));
+ }
+ }
+
+ return sourceFiles;
+ }
+
+ protected void compileTemplates() throws MojoExecutionException, MojoFailureException {
+ try {
+ Iterable<File> templates = findTemplateFiles();
+ for (File file : templates) {
+ JavaClass javaClass = TemplateReader.parse(new FileInputStream(file));
+
+ String fullName = javaClass.getFullName();
+
+ File outFile = new File(outputJavaDirectory,
+ fullName.replace('.', '/') + ".java");
+
+ if (outFile.exists()) {
+ outFile.delete();
+ }
+
+ outFile.getParentFile().mkdirs();
+
+ new JavaClassRenderer().render(javaClass, new PrintWriter(outFile));
+ }
+ } catch (Exception e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ outputJavaDirectory.mkdirs();
+ outputResourcesDirectory.mkdirs();
+ outputTestsDirectory.mkdirs();
+
+ compileTemplates();
+ }
+
+}