Welcome, Guest
Username Password: Remember me

Run external tasks using maven
(1 viewing) (1) Guest
Maven
  • Page:
  • 1

TOPIC: Run external tasks using maven

Run external tasks using maven 1 year, 10 months ago #284

  • scmuser
  • OFFLINE
  • Gold Boarder
  • scm master
  • Posts: 237
  • Points: 3429
  • Karma: 0
  • Honor Medal 2009
Hi,
Is it possible to run ant tasks which is not connected with any build
lifecycle phase?
In other word I would like to perform some action on demand using maven and
antrun plugin

Re:Run external tasks using maven 1 year, 10 months ago #287

  • tpatil
  • OFFLINE
  • Junior Boarder
  • Posts: 27
  • Points: 5111
  • Karma: 0
  • Honor Medal 2009
Targets from external ant file can be run using maven-antrun-plugin.
 
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<configuration>
<tasks>
<echo message="Hi there."/>
<ant antfile="${basedir}/build.xml" target="test"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
 


Also, you can execute the external command using maven-exec-plugin.
 
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>svn</executable>
<arguments>
<argument>info</argument>
<argument>--xml</argument>
</arguments>
<outputFile>target/classes/svninfo.txt</outputFile>
</configuration>
</plugin>
 
  • Page:
  • 1
Time to create page: 2.69 seconds

     
    
Home Forum