Edward Kennedy Edward Kennedy - 5 months ago 15
Java Question

Is there a way to execute a program in maven to help build your project?

I am currently working on a project that uses a tool that takes the following example IDL file and generates about 5 Java classes from it.

struct Example {
int x;
int y;

Is there a way to get Maven to use the command line tool that we use to automatically create those Java classes when it builds?


You can use maven-antrun-plugin plugin to run arbitrary Ant tasks or even any command-line program:

                            <exec executable="ls">
                                <arg value="-l"/>
                                <arg value="-a"/>

With this configuration your command-line program will be executed before the compilation, so generated Java sources will be available to the rest of the code.