4
4

2 回答 2

6

刚刚找到了这个,解决方案在这里:http ://maven.apache.org/surefire/maven-failsafe-plugin/plugin-info.html

例如,maven-failsafe-plugin 与 maven-compiler-plugin 相反,它不在默认的 maven 构建生命周期中。

因此,必须尊重此标签层次结构:

<project>
  <build>
    <pluginManagement>
      <plugins>
        <!-- For understanding only, below is the 'maven-compiler-plugin':
             its path is 'project -> build -> pluginManagement -> plugins
             -> plugin', because it's defaulty part of the maven build
             lifecycle: we just 'manage' it -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          ..
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <!-- HERE is the 'maven-failsafe-plugin':
           its path is 'project -> build -> plugins ->
           plugin', because it's NOT defaulty part of
           the maven build lifecycle: we have to
           'define' it, and not just manage it as
           stated earlier -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        ..
      </plugin>
    </plugins>
  </build>
<project>

引用官方文档链接:“在您的父 POM 中定义插件版本”和“在您的 POM 或父 POM 中使用插件目标”。必须注意区别。

于 2013-10-26T19:54:08.000 回答
1

我将我的故障安全 pom 片段移到了父母的 pom 中,这似乎可以解决问题。我不知道为什么。

于 2013-05-18T08:58:40.963 回答