首页 > 解决方案 > 如何在 Exec Maven 插件执行中继续构建并且不会因错误而失败?

问题描述

尽管 Maven exec 插件添加的执行之一出错,如何使 Maven 构建继续?

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

标签: mavenmaven-3maven-exec-plugin

解决方案


使用成功代码的示例解决方案:

<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>

推荐阅读