四十五

写一个maven插件

核心类:AbstractMojo

核心依赖注入:@Parameter(defaultValue = “${project}”, readonly = true)

参数注入(pom或-D):@Parameter(property = “config.name”)

重写:execute()

配置pom:

   <plugin>
    <groupId>xxx</groupId>
    <artifactId>xxx</artifactId>
    <!--注意使用最新版本-->
    <version>1.1</version>
    <configuration>
        <name>xxxx.xxxx.xxx</name>
    </configuration>
    <executions>
        <execution>
            <phase>process-resources</phase>
            <goals>
                <goal>xxx</goal>
            </goals>
        </execution>
    </executions>
</plugin>