Yeah I like the idea about writing my own maven-plugin, its about time I get around to do that :-) But why add all the complexity of:
http://groovy.codehaus.org/Using+Ant+from+Groovy http://code.google.com/p/indoorsdog/source/browse/jacoco/trunk/jacoco-maven-plugin/src/main/groovy/org/indoorsdog/jacoco/maven/plugin/internal/AgentMojo.groovy which was Luke's initial suggestion? I don't want to modify the ant-run-plugin I just want to execute a specific sequence of tasks for the existing implementation of ant-run and encapsulate this in a plugin that can be used during the build phase for a bunch of projects. >From this link: http://maven.apache.org/guides/plugin/guide-java-plugin-development.html this basically just boils down to create a pom file with <packaging>maven-plugin</packaging> and then just add whatever needs to be done. This "custom" plugin can then be included in another project. Here is an example pom file which defines a few tasks: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test.maven.plugins</groupId> <artifactId>my-maven-plugin</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>maven-plugin</packaging> <dependencies> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> <version>2.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <executions> <execution> <id>test</id> <phase>deploy</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <!-- run task A, B and C--> </tasks> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>org.apache.ant</groupId> <artifactId>ant-jsch</artifactId> <version>1.8.1</version> </dependency> </dependencies> </plugin> </plugins> </build> </project> Then in another project I just add the above plugin to the build phase: ... <build> <plugins> <plugin> <groupId>com.test.maven.plugins</groupId> <artifactId>my-maven-plugin</artifactId> <version>1.0.0-SNAPSHOT</version> </plugin> </plugins> </build> Unfortunately the "my-maven-plugin" never gets executed when the project using the plugin is deployed. Any suggestion why this simple approach does not work? On Tue, Jan 18, 2011 at 11:47 PM, Wayne Fay <wayne...@gmail.com> wrote: >> But I need to use this "custom" task across different projects. Do you >> suggest that I create a full separate native maven project where one > > In that case... I like Luke's initial suggestion of turning this into > a plugin even more. > > Wayne > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org