I can't directly answer your question as I don't use modeler directly for
class generation, but use a build task instead. I recommend using a build
task because you get consistency and you don't have to re-select the
templates over and over. I use *ant* for this, but it can be done with
maven too:
<path id="cgen.classpath">
<fileset dir="lib" includes="cayenne-*.jar" />
<fileset dir="lib" includes="commons-*.jar" />
<fileset dir="lib" includes="velocity-*.jar" />
<fileset dir="lib" includes="log4j-*.jar" />
<fileset dir="lib" includes="slf4j-*.jar" />
</path>
<typedef resource="org/apache/cayenne/tools/antlib.xml">
<classpath refid="cgen.classpath"/>
</typedef>
<target name="generate_java">
<cgen map="src/YourDataMap.map.xml"
superpkg="com.yourpackage.auto"
createpropertynames="true"
supertemplate="${basedir}/cgen/superclass.vm"
template=${basedir}/cgen/subclass.vm"
destDir="src"
outputPattern="*.java"
encoding="UTF-8"
mode="all"
/>
</target>
On Fri, Jan 17, 2020 at 6:47 PM Juan Manuel Diaz Lara
<[email protected]> wrote:
> I am using Cayenn 4.1.RC and trying to user custom templates. I created a
> new template, an selected in preferences, when generating I choose Advance
> and selecte my new template, generations fails with "Unable to find
> resource ..." and the template path, but this path does not have my home
> directory, it shows as a relative path, but in preferencis it has an
> absolute path.
> I revies my data map xml in a text editor and then template path is
> relative, without my home directory as prefix.
> So, I run CayenneModeler from my home directory and the template is found
> correctly. This is strange, because en Preferences path are absolute, but
> when generating they are used as relative to my home directory.
> I do not know if this is a bug o I am missing something.
> Thanks.
>
> Atte. Juan Manuel Díaz Lara