How to bind plugin mojos (goals) to few phases of default lifecycle?

后端 未结 2 491
我寻月下人不归
我寻月下人不归 2021-02-14 05:47

My custom maven plugin have three goals (mojos):

  • convert assigned to default phase: process-test-resources
  • generateStubs
相关标签:
2条回答
  • 2021-02-14 06:25

    I think what you are looking for is the defaultPhase attribute of the Mojo annotation, see https://maven.apache.org/components/plugin-tools/maven-plugin-tools-annotations/ for all the details.

    0 讨论(0)
  • 2021-02-14 06:27

    You can achieve that by replacing ugly-fix with correct goals in <phases> tag:

    <component-set>
      <components>
        <component>
            <role>org.apache.maven.lifecycle.Lifecycle</role>
            <implementation>org.apache.maven.lifecycle.Lifecycle</implementation>
            <role-hint>accurest</role-hint>
            <configuration>
                <id>accurest</id>
                <phases>
                    <process-test-resources>
                        io.codearte.accurest:accurest-maven-plugin:${project.version}:convert
                    </process-test-resources>
                    <generate-test-sources>
                        io.codearte.accurest:accurest-maven-plugin:${project.version}:generateTests
                    </generate-test-sources>
                    <package>
                        io.codearte.accurest:accurest-maven-plugin:${project.version}:generateStubs
                    </package>
                </phases>
                <default-phases>
                    <process-test-resources>
                        io.codearte.accurest:accurest-maven-plugin:${project.version}:convert
                    </process-test-resources>
                    <generate-test-sources>
                        io.codearte.accurest:accurest-maven-plugin:${project.version}:generateTests
                    </generate-test-sources>
                    <package>
                        io.codearte.accurest:accurest-maven-plugin:${project.version}:generateStubs
                    </package>
                </default-phases>
            </configuration>
        </component>
    </components>
    

    0 讨论(0)
提交回复
热议问题