You didn't provide much details on your code generation process but you could maybe simply invoke the code generator with the exec-maven-plugin (see the Examples section). The convention is to generate sources in ${project.build.directory}/generated-sources/<tool>
. Then add the generated sources with the build-helper-plugin and its add-sources
mojo. Bind every thing on the generate-sources
phase.
I'll just show the build-helper stuff below:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-mytool-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/mytool</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
You could also write a simple plugin to wrap your generator. In that case, have a look at the Guide to generating sources.
PS: I may have missed something, there is a kind of mismatch between my answer and the title of your question.