Hi Bryan Thank you for sharing your experience with code the generator. Apart from the source directory trickery my configuration looks very much the same. I just can't get this to work, I spent way to much project time on this already so unfortunately I'm forced to put this issue on hold.
I also tried the 3.7.1 mojo same result; in the top level build the generated-sources are not added to the compiler sources directories. The source code also didn't reveal any obvious pointers to what's wrong with my setup. Anyway thanks, if I manage to resolve this I'll post it here. Regards, Bjorn On Sep 1, 3:45 pm, Bryan Turner <[email protected]> wrote: > We are successfully using the generate goal in our project with several > other modules, and it works as part of the full build. However, ours is > configured quite differently from what I've seen other places. > > To help prevent developers from checking in generated code, our flex-model > module places generated sources under target rather than src/main/flex. We > have a maven-antrun-plugin configuration which copies the contents of > src/main/flex to target/src/as3 before flexmojos:generate runs. This allows > us to version, under src/main/flex, any generated file that we have > customized (non-base, since those are always regenerated), but keeps all of > the generated sources in a directory which is ignored for version control. > > Our configuration looks like this. First, we have properties for all of the > directories in play: > <properties> > > <generatedBaseSourceDirectory>${project.build.directory}/src/base</generatedBaseSourceDirectory> > > <generatedSourceDirectory>${project.build.directory}/src/as3</generatedSourceDirectory> > <versionedSourceDirectory>src/main/flex</versionedSourceDirectory> > </properties> > > Next, the <build/> element has sourceDirectory and testSourceDirectory > defined: > <sourceDirectory>${generatedSourceDirectory}</sourceDirectory> > <testSourceDirectory>src/test/flex</testSourceDirectory> > > Followed by our plugins. maven-antrun-plugin comes first, since it needs to > copy the files we've modified: > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-antrun-plugin</artifactId> > <version>1.3</version> > <executions> > <execution> > <id>copy-sources</id> > <phase>generate-sources</phase> > <goals> > <goal>run</goal> > </goals> > <configuration> > <tasks> > <copy overwrite="true" > todir="${generatedSourceDirectory}"> > <fileset > dir="${versionedSourceDirectory}"/> > </copy> > </tasks> > </configuration> > </execution> > </executions> > </plugin> > As you can see, this copies any files/directories from the > versionedSourceDirectory (src/main/flex) to the generatedSourceDirectory > (target/src/as3). > > That is followed by configuration for the flexmojos-maven-plugin: > <plugin> > <groupId>org.sonatype.flexmojos</groupId> > <artifactId>flexmojos-maven-plugin</artifactId> > <version>${flex.mojos.version}</version> > <extensions>true</extensions> > > <configuration> > <sourcePaths> > <path>${generatedSourceDirectory}</path> > <path>${generatedBaseSourceDirectory}</path> > </sourcePaths> > <storepass/> > </configuration> > <executions> > <execution> > <goals> > <goal>generate</goal> > </goals> > <configuration> > > <baseOutputDirectory>${generatedBaseSourceDirectory}</baseOutputDirectory> > <extraOptions> > > <as3typefactory>com.company.granite.EnhancedAs3TypeFactory</as3typefactory> > > <transformer>com.company.granite.EnhancedGroovyTransformer</transformer> > </extraOptions> > <generatorToUse>graniteds21</generatorToUse> > <includeJavaClasses> > <javaClass/> > </includeJavaClasses> > > <outputDirectory>${generatedSourceDirectory}</outputDirectory> > <templates> > > <base-bean-template>${project.basedir}/gsp/beanBase.gsp</base-bean-template> > > <base-entity-template>${project.basedir}/gsp/entityBase.gsp</base-entity-template> > > <base-remote-template>${project.basedir}/gsp/remoteBase.gsp</base-remote-template> > > <bean-template>${project.basedir}/gsp/bean.gsp</bean-template> > > <entity-template>${project.basedir}/gsp/entity.gsp</entity-template> > > <interface-template>${project.basedir}/gsp/interface.gsp</interface-template> > > <remote-template>${project.basedir}/gsp/remote.gsp</remote-template> > </templates> > </configuration> > </execution> > </executions> > </plugin> > So, several things I'll point out here. First, we're not using ${basedir} > anywhere; we use ${project.basedir}, which seems to create the correct > paths. Also, notice that the <sourcePaths/> is configured at the > *plugin* level, > not the *execution* level (Velo: I know this is not the preferred approach, > so I'm very interested if you have any suggestions on how we could not use > <sourcePaths/> here but still be able to use this layout). We're using > (highly) customized GSPs (remote-template, in 3.x, can only be set in > <templates/>, so we're setting them all that way), AS3 type factory and > Groovy transformer. > > This layout is a bit more work, in the poms, but the developers on the team > really like it. It makes it very simple for them to differentiate between > what should be added to Subversion and what should not. If they customize a > generated file, they copy it to src/main/flex. This layout works correctly > for Maven, FlexBuilder 3, FlashBuilder 4 and IntelliJ 8.1 and 9. > > I hope this has some snippets that might help you figure out what's amiss. > > Bryan > > On Wed, Sep 1, 2010 at 12:51 AM, btyla <[email protected]> wrote: > > The goal itself works okay when executed from within the project > > itself but it doesn't seem to work when the project is part of an > > aggregate build. > > I'm happy to supply any information needed to further investigate this > > issue, just let me know. > > > On Aug 31, 5:15 pm, Marvin Froeder <[email protected]> wrote: > > > What is wrong with the generate goal? > > > > On Tue, Aug 31, 2010 at 11:43 AM, btyla <[email protected]> wrote: > > > > Besides the basedir maven bug, there seems to be something wrong with > > > > the generate goal in 3.8-SNAPSHOT. I also tried to add the generated- > > > > source dir with the maven helper plugin but that didn't work either. > > > > At this point I unfortunately have to disable the code generation. > > > > Should I file a jira issue? > > > > > On Aug 31, 4:15 pm, Marvin Froeder <[email protected]> wrote: > > > > > Well, maven is the one that interpolates the ${basedir}... so I would > > say > > > > it > > > > > is a maven bug, but weird that only you got this problem.... anyway, > > DO > > > > NO > > > > > TAMPER WITH SOURCE PATHS! I really mean it. > > > > > > This is the best way to break everything. > > > > > > VELO > > > > > > On Tue, Aug 31, 2010 at 11:05 AM, btyla <[email protected]> wrote: > > > > > > Hi > > > > > > > I'm generating AS3 classes from their java counterparts. Running > > maven > > > > > > in this project directory works, but when running maven in the > > parent > > > > > > project directory this fails. The generated 'base' cannot be found > > by > > > > > > the compiler. It seems that the generated-sources directory is not > > > > > > added automatically in this case. > > > > > > > I tried the 'includeSources' configuration element but without > > luck; > > > > > > it is ignored and doesn't show in the compiler options. > > > > > > > The 'sourcePaths' doesn't work either because it some how inserts a > > > > > > 'null' path element. > > > > > > > <sourcePaths> > > > > > > <path>${baseDir}/src/main/flex</path> > > > > > > </sourcePaths> > > > > > > > results in: > > > > > > > -compiler.source-path > > X:\bnu-op\bnu-op-flex-application\null\src\main > > > > > > \flex > > > > > > > I'm using flexmojos-3.8-SNAPSHOT > > > > > > > X:\bnu-op>mvn -version > > > > > > Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200) > > > > > > Java version: 1.6.0_21 > > > > > > Java home: C:\Program Files\Java\jdk1.6.0_21\jre > > > > > > Default locale: en_US, platform encoding: Cp1252 > > > > > > OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows" > > > > > > > Regards, > > > > > > Bjorn > > > > > > > -- > > > > > > You received this message because you are subscribed to the Google > > > > > > Groups "Flex Mojos" group. > > > > > > To post to this group, send email to [email protected] > > > > > > To unsubscribe from this group, send email to > > > > > > [email protected]<flex-mojos%[email protected]> > > <flex-mojos%2bunsubscr...@googlegroups.com> > > > > <flex-mojos%[email protected]<flex-mojos%[email protected]> > > <flex-mojos%252bunsubscr...@googlegroups.com> > > > > > > > For more options, visit this group at > > > > > >http://groups.google.com/group/flex-mojos > > > > > > >http://flexmojos.sonatype.org/ > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "Flex Mojos" group. > > > > To post to this group, send email to [email protected] > > > > To unsubscribe from this group, send email to > > > > [email protected]<flex-mojos%[email protected]> > > <flex-mojos%2bunsubscr...@googlegroups.com> > > > > For more options, visit this group at > > > >http://groups.google.com/group/flex-mojos > > > > >http://flexmojos.sonatype.org/-Hide quoted text - > > > > - Show quoted text - > > > -- > > You received this message because you are subscribed to the Google > > Groups "Flex Mojos" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected]<flex-mojos%[email protected]> > > For more options, visit this group at > >http://groups.google.com/group/flex-mojos > > ... > > read more » -- You received this message because you are subscribed to the Google Groups "Flex Mojos" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/flex-mojos http://flexmojos.sonatype.org/
