On Jul 20, 2011, at 10:48 AM, Joseph Senecal wrote:

> The page: http://cayenne.apache.org/doc/cgen.html
> describes a tag: supertemplate
> By activating Maven debuging, I was able to determine that this tag is 
> actually: superTemplate
> And that it is case sensitive.

Actually you are reading the Ant cgen docs. Ant task parameters are case 
insensitive. The Maven plugin docs are here and this page correctly shows the 
name as "superTemplate":

http://cayenne.apache.org/doc/maven2-cgen.html


> What I can't determine is what I should put in that tag to have it use my 
> template instead of the default template. Even though my template is just a 
> copy of the default template, any use of the superTemplate tag results in an 
> error message and no file generation. Here is the error message:
> 7/20/11 12:33:26 AM PDT: Build errors for SFS; 
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
> goal org.apache.cayenne.plugins:maven-cayenne-plugin:3.1M2:cgen (cgen) on 
> project SFS: Error generating classes: 
> 
> I've tried putting in the file name relative to the project/pom. I've tried 
> just the directory that it's in. I've even tried a fully qualified name. None 
> of these worked.
> 
> Has anyone used a custom cgen template? How do you specify it?

I haven't used it in a while, but it should be something like this:

<configuration>         
   <superTemplate 
>${project.build.sourceDirectory}/../templates/mytemplate.vm</superTemplate>    
                  
</configuration>

${project.build.sourceDirectory} is equal to "yourproject/src/main/java", and 
the above assumes you put your templates under  
"yourproject/src/main/templates". The location is arbitrary of course.

Andrus

Reply via email to