Aboslute path in template attribute did the job ....
thank you !
Marco
Marco Gattei ha scritto:
> 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
>
>
This archive was generated by hypermail 2.0.0 : Fri Feb 26 2010 - 13:14:42 EST