You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Lon Varscsak <lo...@gmail.com> on 2014/08/07 19:35:28 UTC

Eclipse/Modeler/Magic

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.
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.


-Lon

Re: Eclipse/Modeler/Magic

Posted by Lon Varscsak <lo...@gmail.com>.
I think it's just you and I John. :D

-Lon


On Thu, Aug 7, 2014 at 1:41 PM, John Huss <jo...@gmail.com> wrote:

> Also, you can vote for this feature here:
> https://issues.apache.org/jira/browse/CAY-1723
>
>
> On Thu, Aug 7, 2014 at 1:49 PM, John Huss <jo...@gmail.com> wrote:
>
> > On Thu, Aug 7, 2014 at 12:35 PM, Lon Varscsak <lo...@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
> >>
> >
> >
>

Re: Eclipse/Modeler/Magic

Posted by John Huss <jo...@gmail.com>.
Also, you can vote for this feature here:
https://issues.apache.org/jira/browse/CAY-1723


On Thu, Aug 7, 2014 at 1:49 PM, John Huss <jo...@gmail.com> wrote:

> On Thu, Aug 7, 2014 at 12:35 PM, Lon Varscsak <lo...@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
>>
>
>

Re: Eclipse/Modeler/Magic

Posted by Andrus Adamchik <an...@objectstyle.org>.
Works semi-automatically for me. I put a declaration for “cgen” in my Maven pom. After a model change I do refresh in Eclipse, and this triggers Maven invocation. Then I have to do refresh again, so I can see the changes. Having said that I am +1 on CAY-1723.

Andrus

On Aug 7, 2014, at 9:49 PM, John Huss <jo...@gmail.com> wrote:

> On Thu, Aug 7, 2014 at 12:35 PM, Lon Varscsak <lo...@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
>> 


Re: Eclipse/Modeler/Magic

Posted by John Huss <jo...@gmail.com>.
On Thu, Aug 7, 2014 at 12:35 PM, Lon Varscsak <lo...@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
>