cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Class generation in 3.2.M2-SNAPSHOT
Date Thu, 30 Oct 2014 15:32:43 GMT
Should be fixed on master per  https://issues.apache.org/jira/browse/CAY-1964

If you were successful compiling Cayenne, appreciate if you could assemble the latest code
and confirm the fix.

Andrus

> On Oct 30, 2014, at 9:46 AM, Andrus Adamchik <andrus@objectstyle.org> wrote:
> 
> I just spotted a couple of 'additionalMaps' processing issues at
> 
> https://github.com/apache/cayenne/blob/47d809497ba45e555ee9fa7460fe315d8c9412b1/plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
> 
> 1. 'convertAdditionalDataMaps' method does not do extension filtering, so there is a
good chance it will include unrelated files, then try to parse them as DataMaps downstream,
then fail. 
> 
> 2. 'convertAdditionalDataMaps' doesn't set the absolute path when creating a File, so
it is resolved against an incorrect base directory. 
> 
> Both should be easy to fix. Let me see what I can do...
> 
> Andrus
> 
> 
> 
> 
>> On Oct 30, 2014, at 12:11 AM, Lon Varscsak <lon.varscsak@gmail.com> wrote:
>> 
>> Below is my plugin section for reference, but when I have the
>> additionalMaps section, I get this error:
>> 
>> [ERROR] Failed to execute goal
>> org.apache.cayenne.plugins:maven-cayenne-plugin:3.2M1:cgen (production) on
>> project shbusinesslogic: Error generating classes: [v.3.2M1 Jul 07 2013
>> 16:23:58] Error loading DataMap, last processed tag: <null>:
>> /Users/varscsak/Development/git/smarthealth/tapestry/libraries/SHCayenneBusinessLogic/cayenne-model.xml
>> (No such file or directory) -> [Help 1]
>> 
>> But the cayenne-model.xml is no where in that directory...not sure why it's
>> trying to look there.
>> 
>> <plugin>
>> 
>> <groupId>org.apache.cayenne.plugins</groupId>
>> 
>> <artifactId>maven-cayenne-plugin</artifactId>
>> 
>>   <!-- shared config part -->
>> 
>>   <configuration>
>> 
>> <destDir>${project.build.sourceDirectory}</destDir>
>> 
>> <template>${basedir}/supporting/subclass.vm</template>
>> 
>> <superTemplate>${basedir}/supporting/superclass.vm</superTemplate>
>> 
>>       <additionalMaps>${project.build.sourceDirectory}/../resources/</
>> additionalMaps>
>> 
>>   </configuration>
>> 
>> <executions>
>> 
>> <execution>
>> 
>>           <id>production</id>
>> 
>>           <!-- Per execution config -->
>> 
>>           <configuration>
>> 
>> <map>${project.build.sourceDirectory}/../resources/production.map.xml</map>
>> 
>>           </configuration>
>> 
>>           <goals>
>> 
>>               <goal>cgen</goal>
>> 
>>           </goals>
>> 
>> </execution>
>> 
>> <execution>
>> 
>>           <id>marketing</id>
>> 
>>           <!-- Per execution config -->
>> 
>>           <configuration>
>> 
>> <map>${project.build.sourceDirectory}/../resources/marketing.map.xml</map>
>> 
>>           </configuration>
>> 
>>           <goals>
>> 
>>               <goal>cgen</goal>
>> 
>>           </goals>
>> 
>> </execution>
>> 
>> <execution>
>> 
>>           <id>customer</id>
>> 
>>           <!-- Per execution config -->
>> 
>>           <configuration>
>> 
>> <map>${project.build.sourceDirectory}/../resources/customer.map.xml</map>
>> 
>>           </configuration>
>> 
>>           <goals>
>> 
>>               <goal>cgen</goal>
>> 
>>           </goals>
>> 
>> </execution>
>> 
>> <execution>
>> 
>>           <id>personalization</id>
>> 
>>           <!-- Per execution config -->
>> 
>>           <configuration>
>> 
>> <map>${project.build.sourceDirectory}/../resources/personalization.map.xml</
>> map>
>> 
>>           </configuration>
>> 
>>           <goals>
>> 
>>               <goal>cgen</goal>
>> 
>>           </goals>
>> 
>> </execution>
>> 
>> </executions>
>> 
>> </plugin>
>> 
>> 
>> On Wed, Oct 29, 2014 at 9:45 AM, Lon Varscsak <lon.varscsak@gmail.com>
>> wrote:
>> 
>>> I agree on the project.xml idea...makes a lot of sense.
>>> 
>>> Okay, on additionalMaps  I was trying this yesterday and couldn't get it
>>> to work.  I've provided the directory to where my datamap files are stored
>>> and I see that it fails (although I don't have any detail...not sure how to
>>> see that in m2e).  I've tried the full path, trailing slashes, no trailing
>>> slashes, etc.
>>> 
>>> I'm probably being dense...but just not sure how. :D
>>> 
>>> -Lon
>>> 
>>> 
>>> On Tue, Oct 28, 2014 at 11:19 PM, Andrus Adamchik <andrus@objectstyle.org>
>>> wrote:
>>> 
>>>> Try using "additionalMaps" parameter:
>>>> 
>>>> 
>>>> http://cayenne.apache.org/docs/3.1/cayenne-guide/including-cayenne-in-project.html#maven-projects
>>>> 
>>>> "additionalMaps [...] A directory that contains additional DataMap XML
>>>> files that may be needed to resolve cross-DataMap relationships for the the
>>>> main DataMap, for which class generation occurs."
>>>> 
>>>> On a side note, I don't recall why we initially went with per-DataMap
>>>> instead of per-project "cgen", but now I feel like cgen should read
>>>> cayenne-project.xml and discover all this information on its own. Until we
>>>> change this approach, "additionalMaps" should help.
>>>> 
>>>> HTH,
>>>> Andrus
>>>> 
>>>>> On Oct 29, 2014, at 2:59 AM, Lon Varscsak <lon.varscsak@gmail.com>
>>>> wrote:
>>>>> 
>>>>> There appears to be an issue either with class generation or something
>>>> with
>>>>> my model.
>>>>> 
>>>>> Whenever I have a relationship that crosses datanodes the TargetEntity
>>>> is
>>>>> null.  So I get things like in the Java class:
>>>>> 
>>>>> public static final
>>>> Property<$importUtils.formatJavaType(${rel.TargetEntity.
>>>>> ClassName})> COMPANY = new Property<$importUtils.formatJavaType(${rel
>>>>> .TargetEntity.ClassName})>("company");
>>>>> 
>>>>> If the entity is with the same datanode I don't have an issue (same
>>>> line in
>>>>> the velocity template).
>>>>> 
>>>>> Any ideas?
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> Lon
>>>> 
>>>> 
>>> 
> 
> 


Mime
View raw message