Is there a way to skip execution of a Maven plugin that does not support skip configuration?

580 views Asked by At

I'm wondering if there is a way to skip the execution of a plugin if this plugin/goal does not support a "skip" configuration?

I'm using the iterator-maven-plugin and I want to skip the plugin execution of the deploy-file goald of the deploy plugin for certain items - so changing the phase to none is not an option.

See below for some example code - I basically want the deploy-file goal be executed for some of the items

<plugin>
    <groupId>com.soebes.maven.plugins</groupId>
    <artifactId>iterator-maven-plugin</artifactId>
    <version>0.5.0</version>
  <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>iterator</goal>
      </goals>
      <configuration>
        <itemsWithProperties>
            <itemWithProperty>
                <name>test</name>
                <properties>
                    <skipDeployment>true</skipDeployment>
                </properties>
            </itemWithProperty>     
            <itemWithProperty>
                <name>prod</name>
                <properties>
                    <skipDeployment>false</skipDeployment>
                </properties>
            </itemWithProperty>     
        </itemsWithProperties>
      </configuration>
        <pluginExecutors>
            <pluginExecutor>    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <goal>deploy-file</goal>
                <configuration>
                    <pomFile>${basedir}/target/checkout/@item@/myFile.pom</pomFile>
                    <file>${basedir}/target/checkout/@item@/myFile.jar</file>
                    <repositoryId>${mavenRepositoryId}</repositoryId>
                    <url>${mavenRepositoryUrl}</url>
                    <!-- if the deploy plugin would support a skip configuration we could do sth. like this -->
                    <skip>${skipDeployment}</skip>
                </configuration>                                    
            </pluginExecutor>
        </pluginExecutors>
      </configuration>
    </execution>
  </executions>
</plugin>
0

There are 0 answers