tags:

views:

386

answers:

3

Can we bind some native OS commands to the maven goals and/or phases?

A: 

See http://mojo.codehaus.org/exec-maven-plugin/usage.html for details

predhme
I guess he can find that link from the page I provided already
jitter
+1  A: 

Not natively.

However, by using the AntRun plugin, you can specify an Ant task (using Exec) that execute a OS command during the build.

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase> <!-- a lifecycle phase --> </phase>
            <configuration>
              <tasks>

                <!--
                  Place any Ant task here. You can add anything
                  you can add between <target> and </target> in a
                  build.xml.
                -->

              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ...
</project>
romaintaz
+1  A: 

Actually there is the Exec Maven Plugin for this cases.

jitter
It answer was selected, because it resolves my problem. But in question I'd took about any comand, not only java tasks.
Max