cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Huss <johnth...@gmail.com>
Subject Re: Eclipse/Modeler/Magic
Date Thu, 07 Aug 2014 18:49:44 GMT
On Thu, Aug 7, 2014 at 12:35 PM, Lon Varscsak <lon.varscsak@gmail.com>
wrote:

> Hey guys,
>
> A couple fo questions about class generation:
>
> 1) Is it possible to trigger (from within Eclipse) an automated build of
> the classes when the model file changes?  I had this with WebObjects/WOLips
> and it's such nice feature.
>

No   :-(

But I haven't found it to be much of an issue.  It's pretty easy to
generate the classes from the Modeler menu, or from an ant target.  I do it
both ways, but use ant more often now since it always has the right
settings.

If you are using ant, the setup could look like this:

<path id="cgen.classpath">
<fileset dir="path/to/cayenne" includes="cayenne-server*.jar" />
<fileset dir="path/to/cayenne" includes="cayenne-di*.jar" />
<fileset dir="path/to/cayenne" includes="commons-*.jar" />
<fileset dir="path/to/cayenne" includes="velocity-*.jar" />
<fileset dir="path/to/cayenne-tools" includes="*.jar" />
</path>
<typedef resource="org/apache/cayenne/tools/antlib.xml">
<classpath refid="cgen.classpath"/>
</typedef>
 <target name="generate.entity.classes">
<touch file="src/MyModel.map.xml" />
<cgen map="src/MyModel.map.xml"
superpkg="com.company.cayenne.auto"
supertemplate="superclass.vm"
template="subclass.vm"
destDir="src"
outputPattern="*.java"
encoding="UTF-8"
mode="all"
/>
</target>

You may be able to add an eclipse "builder" to do it automatically - not
sure..


2) I can't figure out how to get the modeler to build classes into the
> right directories honoring packages.  It seems like if I choose the
> "packages" option (I can't remember the specific name) it doesn't end up in
> the right place.  I'm sure I just misunderstand the options.
>

Do you have the "Use package path" box checked at the bottom of the
generate classes window?


>
>
> -Lon
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message