编写一个简单的输出maven的hello world的插件
1、在eclipse中新建一个maven project项目
然后取名HelloPlugin,建立后,pom文件为(注意packaging为maven-plugin)
并且会自动给你建立类
我们把这个类删掉,然后重建一个
HelloPlugin
注意:这个类上面注解是需要的其中
@goal hello:表示该插件的服务目标,比如tomcat:run--这个run就是一个goal
@phase compile:表示该插件的生效周期阶段
@requiresProject false:表示是否依托于一个项目才能运行该插件
然后执行install 安装
使用:
找一个maven项目,
把他放到build变迁的plugins标签下面。
然后执行 HelloPlugin:hello
控制台就会输出
一个简单的插件就大功告成了。