Maven – Run maven-antrun-plugin without attaching to a lifecycle phase

Long time ago, i had a post about running Ant in Maven using the maven-antrun-plugin but the Ant script would be attached to the Maven lifecycle phase.

 

Sometimes you may just want to run a standalone Ant task in Maven without being involved in any lifecycle phase. In that case, you can try configure the maven-antrun-plugin as follow.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-antrun-plugin</artifactId>
  <version>1.7</version>
  <configuration>
    <tasks>
      <echo message="Hello world"/>
    </tasks>
  </configuration>
  <goals>
    <goal>run</goal>
  </goals>
</plugin>

 

You can run it directly by

  • mvn antrun:run

 

Done =)

Reference: StackOverflow – How to call maven-antrun-plugin target without attach execution to a maven phase ?

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.