cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <mkien...@gmail.com>
Subject Re: cgen task
Date Fri, 26 Feb 2010 17:22:01 GMT
That looks right to me when I compare it to my Cayenne 1.2 templates.

As a test, try specifying an absolute path of
\java\click-click\clickclick\pm-test\pojo.vm and see what it does.
Maybe for 3.0 it is now looking in the classpath instead of relative
to the ant task base.

Another good general-purpose way to track these kinds of things down
is to install ProcessMonitor and see where Windows is actually trying
to read the file from.

ProcessMonitor
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

You might also be able to run ant in debug mode and get more
information that way.


On Fri, Feb 26, 2010 at 11:40 AM, Marco Gattei <marco.gattei@gmail.com> wrote:
> Hi everyone,
>   i'm trying to play a bit with CAyenne cgen task, to see if i can
> automate the geration of pojo counterparts to my data objects, to use as dto
> in a JAX-WS service.
>
> i've created mi pojo.vm template file and placed it  in same directory with
> the ant script
>
> project
>   +---- generate_pojo.xml
>    |
>   +---- pojo.vm
>   |
>   +---- src
>
>
> generate_pojo.xml looks like :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project name="changeme" default="all" basedir=".">
>  <target name="generate pojos" >
> <path id="classpath">
>     <!-- my local cayenne directory -->
>       <fileset dir="D:/java/cayenne-3.0RC2-win/lib" >
>           <include name="cayenne-tools-3.0RC2.jar" />
>           <include name="cayenne-server-3.0RC2.jar" />
>           <include name="third-party/ashwood-2.0.jar" />
>           <include name="third-party/commons-collections-3.1.jar" />
>           <include name="third-party/commons-logging-1.1.jar" />
>           <include name="third-party/velocity-1.3.jar" />
>           <include name="third-party/vpp-2.2.1.jar" />
>
>       </fileset>
>   </path>
>
>   <echo message="classpath setup " />
>
>   <typedef resource="org/apache/cayenne/tools/antlib.xml">
>       <classpath refid="classpath"/>
>   </typedef>
>
>       <echo message="task inited" />
>
>
>       <delete dir="src/com/sapidata/piemme/pojo" />
>
>       <mkdir dir="src/com/sapidata/piemme/pojo" />
>
>
>       <cgen map="src/PMMap.map.xml"
>             destDir="src/com/sapidata/piemme/pojo"
>             makepairs="false"
>             usepkgpath="false"
>             includeEntities="*"
>             template="pojo.vm"
>             outputPattern="*.java"/>
>
>   </target>
> </project>
>
>
> but executing results in
>
>
> D:\java\click-click\clickclick\pm-test\GeneraPojo.xml:39:
> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> resource 'pojo.vm'
>       at
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:501)
>       at
> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:384)
>       at
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:814)
>       at
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:796)
>       at
> org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:512)
>       at
> org.apache.cayenne.gen.ClassGenerationAction.getTemplate(ClassGenerationAction.java:275)
>       at
> org.apache.cayenne.gen.ClassGenerationAction.execute(ClassGenerationAction.java:241)
>       at
> org.apache.cayenne.gen.ClassGenerationAction.execute(ClassGenerationAction.java:213)
>       at
> org.apache.cayenne.tools.CayenneGeneratorTask.execute(CayenneGeneratorTask.java:163)
>
>
>
> removing the attributes template="pojo.vm"  generates the classes, but using
> default templates.
>
> Where should  be put pojo.vm ?
>
> Marco
>
>

Mime
View raw message