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/10/27 22:46:02 UTC

Maven cgen

Hey all,

I'm using the cgen task to generate my class files, but I'm unsure of how
to tell it to build for several data maps.  I tried including multiple
<map> elements, but it only seems to execute for the final entry.

Any thoughts?

Thanks,

Lon

Re: Maven cgen

Posted by Lon Varscsak <lo...@gmail.com>.
Awesome, that'll work.  Thanks!

-Lon

On Mon, Oct 27, 2014 at 11:14 PM, Andrus Adamchik <an...@objectstyle.org>
wrote:

>
> > On Oct 28, 2014, at 12:46 AM, Lon Varscsak <lo...@gmail.com>
> wrote:
> >
> > Hey all,
> >
> > I'm using the cgen task to generate my class files, but I'm unsure of how
> > to tell it to build for several data maps.  I tried including multiple
> > <map> elements, but it only seems to execute for the final entry.
> >
> > Any thoughts?
> >
> > Thanks,
> >
> > Lon
>
> I'd suggest using multiple <execution> sections within the same plugin
> declaration. You can place properties either in the common "configuration"
> section, or into execution "configuration" sections:
>
> <plugin>
>     <groupId>org.apache.cayenne.plugins</groupId>
>     <artifactId>maven-cayenne-plugin</artifactId>
>
>     <!-- shared config part -->
>     <configuration>
>         <destDir>${project.basedir}/src/main/java</destDir>
>         <superPkg>org.example.model.auto</superPkg>
>     </configuration>
>
>     <executions>
>         <execution>
>             <id>map1</id>
>             <!-- Per execution config -->
>             <configuration>
>                 <map>${project.basedir}/src/main/resources/m1.map.xml</map>
>             </configuration>
>             <goals>
>                 <goal>cgen</goal>
>             </goals>
>         </execution>
>         <execution>
>             <id>map2</id>
>             <!-- Per execution config -->
>             <configuration>
>                 <map>${project.basedir}/src/main/resources/m2.map.xml</map>
>             </configuration>
>             <goals>
>                 <goal>cgen</goal>
>             </goals>
>         </execution>
>     </executions>
> </plugin>
>
> Andrus

Re: Maven cgen

Posted by Andrus Adamchik <an...@objectstyle.org>.
> On Oct 28, 2014, at 12:46 AM, Lon Varscsak <lo...@gmail.com> wrote:
> 
> Hey all,
> 
> I'm using the cgen task to generate my class files, but I'm unsure of how
> to tell it to build for several data maps.  I tried including multiple
> <map> elements, but it only seems to execute for the final entry.
> 
> Any thoughts?
> 
> Thanks,
> 
> Lon

I'd suggest using multiple <execution> sections within the same plugin declaration. You can place properties either in the common "configuration" section, or into execution "configuration" sections:

<plugin>
    <groupId>org.apache.cayenne.plugins</groupId>
    <artifactId>maven-cayenne-plugin</artifactId>

    <!-- shared config part -->
    <configuration>
        <destDir>${project.basedir}/src/main/java</destDir>
        <superPkg>org.example.model.auto</superPkg>
    </configuration>

    <executions>
        <execution>
            <id>map1</id>
            <!-- Per execution config -->
            <configuration>
                <map>${project.basedir}/src/main/resources/m1.map.xml</map>
            </configuration>
            <goals>
                <goal>cgen</goal>
            </goals>
        </execution>
        <execution>
            <id>map2</id>
            <!-- Per execution config -->
            <configuration>
                <map>${project.basedir}/src/main/resources/m2.map.xml</map>
            </configuration>
            <goals>
                <goal>cgen</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Andrus