views:

910

answers:

1

When executing 'mvn antrun:run' my tasks are not run.. I have an echo task, but no output is shown.. When running the phases that the tasks are bound to, they do get executed..

How do I specifically execute the tasks from the commandline?

+1  A: 

Assuming something like this is added to your pom.xml

<build>
   <plugins>
       <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <executions>
            <execution>
              <phase>package</phase><!--Change this to control when it runs -->
              <configuration>
                <tasks>
      <echo  message="Hello, maven"/>
                </tasks>
              </configuration>
              <goals>
                <goal>run</goal><!-- this is to call antrun:run -->
              </goals>
            </execution>
          </executions>
        </plugin>
     </plugins>
  </build>

Executing mvn package will result in the following on your console

[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
     [echo] Hello, maven
[INFO] Executed tasks

You can change the phase to have your ant script run at whatever point you need.

sal
Thank you for the answer. I'm using this specific ant task to deploy an axis webservice ( with a program called AdminClient). I can only deploy it after my container ( in this case jetty:run ) has started.. So which phase would be relevant?
vpalle
Jetty:run would likely be running at pre-integration-test. I would change the phase to post-integration-test. The run "mvn verify" to run both the jetty and ant tasks.
sal