Edward Kennedy Edward Kennedy - 1 year ago 64
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download