Disabling goals in a maven plugin execution

前端 未结 1 1545
星月不相逢
星月不相逢 2021-01-06 02:46

I have a setup where most of my projects require the xtend plugin to be run both for the compile and testCompile goals. I describe it in a pluginManagement section:

相关标签:
1条回答
  • 2021-01-06 02:50

    Generally, you can only disables executions with a trick:

    Set the executions phase to non existant phase (dont-execute). Note however, that you have to use two different execution ids to allow both goals to be individually turned off:

    <plugin>
        <groupId>org.eclipse.xtend</groupId>
        <artifactId>xtend-maven-plugin</artifactId>
        <version>2.5.3</version>
        <executions>
            <execution>
                <id>xtend-compile</id>
                <goals>
                    <goal>compile</goal>
                    <goal>testCompile</goal>
                </goals>
            </execution>
            <execution>
                <id>xtend-testCompile</id>
                <goals>
                    <goal>testCompile</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    

    Submodule:

    <plugin>
        <groupId>org.eclipse.xtend</groupId>
        <artifactId>xtend-maven-plugin</artifactId>
        <version>2.5.3</version>
        <executions>
            <execution>
                <id>xtend-testCompile</id>
                <phase>dont-execute</phase>
            </execution>
        </executions>
    </plugin>
    

    In your specific case, you could, of course, also use the skipXtend configuration property in each execution to not skip the execution, but only prevent the plugin from doing anything:

    <plugin>
        <groupId>org.eclipse.xtend</groupId>
        <artifactId>xtend-maven-plugin</artifactId>
        <version>2.5.3</version>
        <executions>
            <execution>
                <id>xtend-testCompile</id>
                <configuration>
                    <skipXtend>xtend-testCompile</skipXtend>
                </configuration>
            </execution>
        </executions>
    </plugin>
    
    0 讨论(0)
提交回复
热议问题