The source set for what FlexMojos can generate AS3 classes for is dependent on the classpath, usually controlled by dependencies. However, if you configure FlexMojos to run the generator goal in an otherwise Java module, it should be able to generate source from the Java classes there. Chances are good you'll have to jump through hoops to make that happen, though, because it's not very good practice and the Maven execution phases don't line up well (You'd need to explicitly bind the FlexMojos generate goal to a different phase after the compile phase or your Java code won't have been compiled when FlexMojos tries to generate AS3 code during the generate-sources phase where it binds by default. If you don't understand what all of that means [Not trying to be insulting, just stating a fact], you probably shouldn't try to set it up that way.). You're better off compiling your Java model in one Maven module and generating your Flex model from it in another module. That way you can add a dependency for your Java model to your Flex model's pom.xml.
For example, on one of the projects I'm working on, we have our Java model split across 3 different modules (database model, service model, service API--we code-generate Flex interfaces/implementations for accessing all of our Java services which are exposed via GraniteDS). We then have a single fx-model module which has dependencies on those 3 modules with scope "provided" which code-generates the Flex model. This layout is simple to setup and maintain. Also, for what it's worth, if you're working on a version-controlled project, I'd recommend *not* generating source into src/main/flex. It always ends up checked in, even when it shouldn't. Bryan Turner On Fri, Apr 29, 2011 at 12:29 PM, Bryan Turner <[email protected]>wrote: > To configure specific classes for generation: > <plugin> > <groupId>org.sonatype.flexmojos</groupId> > <artifactId>flexmojos-maven-plugin</artifactId> > <extensions>true</extensions> > ... > > <executions> > <execution> > <goals> > <goal>generate</goal> > </goals> > <configuration> > ... > <excludeJavaClasses> > > <javaClass>com.katasoft.shogun.**.*Exception</javaClass> > > <javaClass>com.katasoft.shogun.application.Application</javaClass> > </excludeJavaClasses> > <generatorToUse>graniteds21</generatorToUse> > <includeJavaClasses> > > <javaClass>com.katasoft.shogun.**Service</javaClass> > > <javaClass>com.katasoft.shogun.application.*</javaClass> > > <javaClass>com.katasoft.shogun.directory.*</javaClass> > > <javaClass>com.katasoft.shogun.entity.PersistentEntity</javaClass> > </includeJavaClasses> > </configuration> > </execution> > </executions> > </plugin> > Notice that FlexMojos supports wildcards, in similar style to ant. ** > matches anything anywhere, * matches things at the same level. So > com.katasoft.shogun.**Service, for us, is matching (for example) > com.katasoft.shogun.application.ApplicationService, > com.katasoft.shogun.directory.DirectoryService, etc. We have many more > include/exclude entries in our pom.xml, but this should show you the basis > of what you need. > > Hope this helps, > Bryan Turner > > On Fri, Apr 29, 2011 at 11:21 AM, Eric B <[email protected]> wrote: > >> On Fri, Apr 29, 2011 at 11:50 AM, Christofer Dutz < >> [email protected]> wrote: >> >>> My Favourite documentation is the code itself ... I sort of got used >>> to having a look at the code in order to configure stuff. Due to the >>> lackk of documentation. That's why I started documenting my stuff in >>> the first place (I sort of keept re-fugguring out stuff over and over >>> again) >>> >>> >> Hi Chris, >> >> I'm having a lot of difficulty right now getting the specific classes I >> want generated. I've downloaded the sources for the SimpleGeneratorMojo, >> and put my breakpoints in there, and I see the problem is related to the >> classes it is scanning over. The method getDirectDependencies() is >> returning a list of jars but none of my comipled source code classes. >> Consequently, any <includeClass> filters I put to match my classes are >> never matched, and classes do not get generated. >> >> How do you specify which path(s) to use as the source folders when >> generating the classes? You have <includeClass> filters, but are those >> classes in a Jar file already, or are they part of your project? >> >> As I type this, I am wondering if perhaps I am potentially going about >> this backwards? Do you know if this plugin can be used in my Java project >> to generate the AS sources from my Java classes, or must it be used in a >> Flex project to generate AS classes from a java jar file instead? >> >> Thanks so much! >> >> Eric >> >> -- >> 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/ >> > > -- 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/
