Reputation: 704
We've a requirement where we need to auto generate the code and use it in another project. I'm using following code for autogenerating the code. But doing a "maven package" only generates sources and it doesn't give any errors in the log. Any help would be much appreciated.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>exec-one</id>
<phase>compile</phase>
<configuration>
<mainClass>com.xx.yy.zzz.aa.bb.Autgen</mainClass>
<arguments>
<argument>-o</argument>
<argument>${srcOutputDir}/${packageDir}</argument>
</arguments>
</configuration>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Upvotes: 3
Views: 2396
Reputation: 97467
First i would suggest to generate the code in a different phase like generate-sources and next you have to tell the compiler plugin to compile that generated code as well. Take a look at the build-help-plugin for this purpose.
Upvotes: 1