maven ant plugin

pom.xml jar matched
-----------------------
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hsbc.jack</groupId>
<artifactId>antplugin</artifactId>
<packaging>maven-plugin</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>antplugin Maven Mojo</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-script-ant</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-ant-tasks</artifactId>
<version>2.1.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.6</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-ant</artifactId>
<version>2.8</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>


---------------------------------------build.xml
<project xmlns:artifact="urn:maven-artifact-ant">
<target name="echotarget" depends="package">
<echo>${message}</echo>
</target>


<target name="init_maven">
<echo>init maven ant</echo>
        <!--
        remember to set M2_REPO before use this build.xml, for example in eclispe:
        "Window→Preferences→Ant→Runtime", add a new property named "M2_REPO" and set it value point to the path of your maven
        local repository; Or you can set it in build.properties.  You need do one (and only one) of them.
        -->
        <!--
        <path id="maven-ant-tasks.classpath" path="${M2_REPO}/org/apache/maven/maven-ant-tasks/2.0.9/maven-ant-tasks-2.0.9.jar" />
        <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" />
       
         <typedef resource="org/apache/maven/artifact/ant/antlib.xml"  />
-->
       <typedef resource="org/apache/maven/artifact/ant/antlib.xml"  uri="urn:maven-artifact-ant" />
       <echo>init maven ant end</echo>
    </target>
   
    <target name="package" depends="init_maven">
    <echo>clean begin</echo>
    <artifact:mvn pom="E:\eclipse_workspace\SHDemo\pom.xml" mavenHome="D:\softutil\apache-maven-3.0.5" fork="true">
    <arg value="clean"/>
    <arg value="package"/>
  </artifact:mvn>
    <echo>clean end</echo>
    </target>
   
   
   
   
</project>

你可能感兴趣的:(plugin)