The following is not going to really help you, but I just wanted to point out that a plugin was recently initiated at mojo (still in the sandbox) dedicated to templating (called templating-maven-plugin). It's currently only supporting Maven sources filtering, but the plan is to support different templating engines like velocity or mustache for example.
Cheers Le 28 févr. 2013 12:17, "Anders Hammar" <and...@hammar.net> a écrit : > I haven't seen any generator plugin that does what you're looking for. > > Wearing a Maven hat, I don't think that having these stub classes generated > to src/main/java belongs to the build lifecycle. It's a separate process > that should be executed outside of a Maven build. SO you would then have a > separate goal for that is not bound to a phase by default. > > /Anders > > > On Thu, Feb 28, 2013 at 10:57 AM, christofer.d...@c-ware.de < > christofer.d...@c-ware.de> wrote: > > > Ahem ... this wasn't quite the path I was indenting to go with my > question. > > > > What I am looking for is a generator-plugin that uses a template engine > > (such as Velocity) to generate code, and uses as input an pojo-object > model > > representing the details of a Java class that it should generate code > for. > > > > Now I would like to have (or create, if I have to) a plugin, that allows > > me to specify which classes I am addressing using some include/exclude > > config. > > > > I could configure different include/exclude groups, each one in one > > execution and for each I could provide a set of: > > - resourceTemplates > > - testResourceTemplates > > - sourceStubTemplates > > - sourceTemplates > > - testSourceStubTemplates > > - testSourceTemplates > > - ... > > So for each matched class, I could generage: > > - resources into the target/generated-resources directory using the > > resourceTemplates (could be more than one) > > - testResources into the target/generates-test-resources directory using > > the testResourceTemplates, ... > > - source code into target/generated-sources ... > > - test source code into target/generated-test-sources ... > > > > One speciality I liked with GraniteDS was the ability to have > > auto-generated stub-classes generated in src/main/java ... if a class > > allready existed, no code would be generated, but if a class didn't > exist, > > it would be generated. This was great for creating classes that extend > > other generated classes and to allow customization. Something simple as > > this: > > > > public class MyClass extends MyClassBase { > > } > > > > And MyClassBase is generated to target/generated-sources. > > > > With such a plugin I could be able to generate my JPA MetaModel classes, > > my DTOs, SQL scripts, ... and wouldn't have to configure thousands of > > different generators. People could develop best-practice templates for > > general purpose tasks. > > > > Hope this clarified, what I was looking for. > > > > If nothing similar exists, I would like to start developing something > like > > this, because I think it would make my life a lot easier. > > > > Chris > > > > ________________________________________ > > Von: Stadelmann Josef [josef.stadelm...@axa-winterthur.ch] > > Gesendet: Donnerstag, 28. Februar 2013 09:52 > > An: Maven Users List > > Betreff: AW: Is there any generic Maven code generator? > > > > A code generator needs input. Hence some "generic formal language" is > used > > to specify the input to the genric code generator? UML? Visualization of > a > > generic language could mean - speak UML, UML is a reality today. UML > > modells can says much more then 1000 words? Hence I opt for better > > integration of modelling tools with maven. Also roundtrip engineering is > a > > must. Enterprise Architect (EA) is able to generate code from UML and > other > > diagrams for many target compiler and it helps you to have code, modell > and > > documentation in sync. And EA can be feed with code and generates your > > diagramms. A task which only ends when the modells become to complex. > Maven > > is much about geting and nailing dependent components together. If maven > > finds the dependecies, a tool like EA could use input to draw i.e. the > > component diagram, maybe a maven plugin can pave the way for EA. Other > > whise, in my mind, there are far too many tools around and I get to often > > the feeling that each time a problem developes, folk starts to seek a > tool > > to avoid some brain work. So if one knows in which aspects maven poms > could > > be used toward EA to get ceratin artiacs visualized for better > > understanding, that would be almost a very good step into proper > direction. > > Josef > > > > > > -----Ursprüngliche Nachricht----- > > Von: christofer.d...@c-ware.de [mailto:christofer.d...@c-ware.de] > > Gesendet: Mittwoch, 27. Februar 2013 12:31 > > An: users@maven.apache.org > > Betreff: Is there any generic Maven code generator? > > > > I just posted this to Stackoverflow, but after posting I realized, that I > > should have come here first :-( > > > > > > I am currently working on a project, that makes intense usage of code > > generation for various purposes. One generator generates SQL scripts from > > jpa entities. Another generates DTOs from pojos, another generates the > > JPA2.0 meta model, jet another generates some xml and schema files based > on > > Java classes ... each generator works completely different needs to be > > configured differently. > > > > My question now is ... is there any generic maven code generator plugin > > out there with the following attributes: > > > > * > > Creates a pojo model of a Java class (Names, Properties, Annotation, > > Methods ...) > > * > > Uses templates for defining the output that uses the pojo model to > > generate any output. > > * > > Allows me to specify multiple templates for one class > > * > > Allows me to generate code and resources > > * > > Allows me to generate a base class to target/generated-sources and a > dummy > > implementation to src/main/java which simply extends the base class (If > the > > dummy class in src/main/java exists, nothing happens, if it doesn't it > > generates such a dummy class. This code is checked in to the SCM and > allows > > extending the generated classes manually) > > > > I am using the Flexmojos GraniteDS plugin for generating my ActionScript > > model code, but it's pretty specialized for that particular purpose. > > > > I think such a generic generator would make things a lot easier ... is > > there something like that available out there, or do I have to start > > implementing it myself? > > > > Chris > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > > For additional commands, e-mail: users-h...@maven.apache.org > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > > For additional commands, e-mail: users-h...@maven.apache.org > > > > >