Re: cayenne-maven-plugin and its executions environment

Maria Huber <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <trinity-ba3a2fc7-fb41-4eb2-9791-58e2461a8b64-1612338095547@3c-app-gmx-bs48>
Hey Andrus,
I added two execution tags within the execution environment. According to maven's '-X' output, the loaded configuration looks like this:

"
[DEBUG] Goal:          org.apache.cayenne.plugins:cayenne-maven-plugin:4.2.M2:cgen (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <defaultDir default-value="${project.build.sourceDirectory}"/>
  <force default-value="false">${force}</force>
</configuration>
[DEBUG] =======================================================================
"

So the map information is missing. Maybe that why the mentioned error "The parameters 'map' for goal org.apache.cayenne.plugins:cayenne-maven-plugin:4.2.M2:cgen are missing or invalid" occurs.
Is there any Maven settings to change this import behavior?

Kind regards, Maria



On 2021/02/02 07:21:48, Andrus Adamchik <[email protected]> wrote:
> Defining two "<execution>" tags with different map names should be the solution to that. And this should work. After all global and per-execution config merging is a feature of the Maven engine, and Cayenne does not mess with it. Try running mvn with the "-X" option. It will print the actual merged configurations for each plugin invocation and will help to debug the issue.>
>
> Andrus>
>
>
> > On Feb 1, 2021, at 11:14 PM, Maria Huber <[email protected]> wrote:>
> > >
> > Hey Andrus,>
> > thanks for the help. Unfortunately this typing error doesn't solve my problem.>
> > I want to define two different map-files and run for both the cgen command. If possible this should work without running the modeler.>
> > Is there any solution to realize this in version 4.2.M2 (except the execution environment)?>
> > The config outside configuration solution allows only to define one map.>
> > >
> > Kind regards,>
> > Maria>
> > >
> > >
> > On 2021/02/01 05:53:27, Andrus Adamchik <[email protected]> wrote:>
> >> Hi Maria,>>
> >> >
> >> This may be just a typo in your POM:>>
> >> >
> >>> <map>${project.basedir}/src/main/resources/scenario/my.map.xml</map>>>
> >> >
> >> vs>>
> >> >
> >>> <map>${project.basedir}/src/main/resources/my.map.xml</map>>>
> >> >
> >> >
> >> ("scenario" folder is missing in the last case)>>
> >> >
> >> As an aside, since 4.1 CayenneModeler started to save your class generation settings in .map.xml in a portable way, so our default advice became to use CayenneModeler instead of Maven cgen for class generation. (But of course you can keep using Maven if that better fits your workflow).>>
> >> >
> >> Andrus>>
> >> >
> >> >
> >>> On Jan 31, 2021, at 7:36 PM, Maria Huber <[email protected]> wrote:>>
> >>>> >
> >>> Hey,>>
> >>> after spending quite some time, I still can't get the cayenne-maven-plugin (4.4.M2) running as described in the latest "Cayenne-Guide".>>
> >>> The problem is related to the execution environment.>>
> >>> This setting works just fine:>>
> >>>> >
> >>> <plugin>>>
> >>>    <groupId>org.apache.cayenne.plugins</groupId>>>
> >>>    <artifactId>cayenne-maven-plugin</artifactId>>>
> >>>    <version>${cayenne.version}</version>>>
> >>>    <configuration>>>
> >>>            <map>${project.basedir}/src/main/resources/scenario/my.map.xml</map>>>
> >>>    </configuration>>>
> >>>    <executions>>>
> >>>            <execution>>>
> >>>                    <goals>>>
> >>>                            <goal>cgen</goal>>>
> >>>                    </goals>>>
> >>>            </execution>>>
> >>>    </executions>>>
> >>> </plugin>>>
> >>>> >
> >>> But if I put the configuration inside the execution tag (as described in the Cayenne Guide), Maven can't find the map property.>>
> >>>> >
> >>> <plugin>>>
> >>>    <groupId>org.apache.cayenne.plugins</groupId>>>
> >>>    <artifactId>cayenne-maven-plugin</artifactId>>>
> >>>    <version>${cayenne.version}</version>>>
> >>>    <executions>>>
> >>>            <execution>>>
> >>>                    <id>execution1</id>>>
> >>>                    <configuration>>>
> >>>                            <map>${project.basedir}/src/main/resources/my.map.xml</map>>>
> >>>                    </configuration>>>
> >>>                    <goals>>>
> >>>                            <goal>cgen</goal>>>
> >>>                    </goals>>>
> >>>            </execution>>>
> >>>    </executions>>>
> >>> </plugin>>>
> >>>> >
> >>> This is the error message:>>
> >>> "Failed to execute goal org.apache.cayenne.plugins:cayenne-maven-plugin:4.2.M2:cgen (default-cli) on project my-cayenne: The parameters 'map' for goal org.apache.cayenne.plugins:cayenne-maven-plugin:4.2.M2:cgen are missing or invalid">>
> >>>> >
> >>> According to Stackoverflow, Maven handles the config-tag like this:>>
> >>> 1. If the <configuration> is outside the <executions> , it is the configuration for the plugin to be used no matter what the life-cycle phase is.>>
> >>> 2. If the <configuration> is inside the <executions>, it is the configuration to be used in certain life-cycle phase.>>
> >>>> >
> >>> What could be the reason for this strange behavior?>>
> >>>> >
> >>> Kind regards>>
> >>>> >
> >>>> >
> >>>> >
> >>>> >
> >>>> >
> >> >
> >> >
> > >
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.