maven 定义 plugin

pom.xml


  4.0.0
  
  com.wurd
  wu_m
  0.1
  
  
    
      org.apache.maven
      maven-plugin-api
      jar
      2.0.6
    
  

继承AbstractMojo 

package com.wurd.plugins.test;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;

public class TestMojo extends AbstractMojo {
	public void execute() throws MojoExecutionException {
		System.out.println("#####");
		System.out.println("do something");
		System.out.println("#####");
	}
}

plugin.xml(放在META-INF/maven下边)



  test plugin
  test plugin
  com.wurd
  wu_m
  0.1
  test
  false
  true
  
    
      test
      test plugin-test
      false
      true
      false
      false
      false
      true
      com.wurd.plugins.test.TestMojo
      java
      per-lookup
      once-per-session
      true
    
  
  
    
      org.apache.maven
      maven-plugin-api
      jar
      2.0.6
    
    
      org.codehaus.plexus
      plexus-utils
      jar
      3.0
    
  

打包到本地仓库

mvn install

命令行执行

mvn com.wurd:wu_m:0.1:test

pom引用


  
    com.wurd
    wu_m
    0.1
  

你可能感兴趣的:(maven,maven,java)