Overriding 'clean' lifecycle in Maven

二次信任 提交于 2019-12-04 02:31:06

For what you describe, it is simpler to just prevent the maven-clean-plugin from running during the clean phase, and attach customPlugin to the clean phase instead. This is simpler than short-circuiting the whole lifecycle, and keeps all your maven config in your pom.

1 prevent the maven-clean-plugin

<plugin>
    <artifactId>maven-clean-plugin</artifactId>
    <version>2.4.1</version>
    <configuration>
        <skip>true</skip>
    </configuration>
</plugin>

2 attach your own plugin to the clean phase

<plugin>
    <artifactId>maven-customPlugin-plugin</artifactId>
    <version>customPlugin-version</version>
    <executions>
        <execution>
            <id>customised-clean</id>
            <goals>
                <goal>customClean</goal>
            </goals>
            <phase>clean</phase>
        </execution>
    </executions>
</plugin>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!