I am currently porting an Ant-powered code generator to Maven and would like
to get input from this group for best practices with respect to code
generation in Maven.
Let's see if I have this right:
I wrote a Maven mojo to drive the code generator and can configure it in the
Maven project used for code generation.
I should always isolate the code generation into a single Maven module (this
could be part of a multi-module Maven project though) so that I can declare
the source directory for the generated code under the target directory.
For example, something like this would be declared in the module where code
generation takes place:
<build>
<sourceDirectory>${project.build.directory}/codegen/java</sourceDirectory>
...
...
The jar file artifact resulting from the code generation module would only
contain class files from the generator.
Since the standard src/main/java <sourceDirectory/> has been 'usurped' by
the source directory where the code generator wrote its code, I shouldn't
have any other Java code under src/main/java.
Does this sound correct? Is this the best practice for a Maven module for
code generation? Does anyone on this group do this differently than what I
sketched out here? If so, why and what are the advantages of your
alternative approach?
Thanks in advance for your input!
:handshake:
--
View this message in context:
http://www.nabble.com/Best-Practice-for-code-generation-scenarios-in-Maven-tp19638243p19638243.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]