3

How can the maven build be made to continue despite an error in one of the execution added by the Maven exec plugin?

https://www.mojohaus.org/exec-maven-plugin/usage.html

rob2universe
  • 7,059
  • 39
  • 54

2 Answers2

6

Example solution using success code:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>3.0.0</version>
  <executions>
    <execution>
      <id>docker-rmi</id>
        <phase>clean</phase>
        <goals>
          <goal>exec</goal>
        </goals>
        <configuration>
          <executable>docker</executable>
          <workingDirectory>${project.basedir}</workingDirectory>
          <arguments>
            <argument>rmi</argument>
            <argument>${project.groupId}/${project.artifactId}:${project.version</argument>
          </arguments>
          <successCodes>
            <successCode>0</successCode>
            <successCode>1</successCode>
          </successCodes>
        </configuration>
    </execution>
  </executions>
</plugin>
rob2universe
  • 7,059
  • 39
  • 54
1

You can use successCodes and list the error codes what you want to treat as success. This was created for non-compliant application according to the docs docs but it is useful for such scenario.

I don't know any wildcard solution so you have to explicitly state the list of error codes for the successCodes.

Gebezs
  • 696
  • 3
  • 9