Providing configuration for existing plugins in maven lifecycle mapping

不羁的心 提交于 2019-12-09 01:33:28

问题


I would like to provide a maven plugin with a custom <packaging> that provides a complex lifecycle. As part of this lifecycle, I need to run the maven-compiler-plugin 2 times in different phases with different configurations. I would like to make this packaging as simple as possible to use. The goal would be that all a consumer of this plugin would have to do is select the new packaging and not have to do any plugin execution configuration:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>some.other.group</groupId>
  <artifactId>something-useful</artifactId>
  <version>1.0.0</version>
  <packaging>my-maven-plugin-jar</packaging>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>my.group.id</groupId>
        <artifactId>my-maven-plugin</artifactId>
        <version>0.0.1</version>
        <extensions>true</extensions
      </plugin>
    </plugin>
  </build>
</project>

Then my custom lifecycle would bind the all the goals I needed including the compiler both times. The problem is, each compiler pass is compiling different source (using <includes> and <excludes> into different destinations (using outputDirectory) and I cant find any way to configure them without doing so in the <executions> sub-element of pom using my plugin. I could do this with an archetype, but it seems to me to be a little more elegant to do this with a custom packaging. Any suggestions?

来源:https://stackoverflow.com/questions/6218769/providing-configuration-for-existing-plugins-in-maven-lifecycle-mapping

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!