我有一个spring boot应用程序。
将sprinboot pom添加为父级
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
</parent>这是spring-boot-starter-parent-2.1.2中的<pluginmanagement>部分中提到的故障安全依赖项
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<classesDirectory>${project.build.outputDirectory</classesDirectory>
</configuration>
</plugin>在我的项目构建阶段,我也在不同的概要文件下定义了一个故障安全机制。我所有的IT文件都以'IT‘结尾。
<profile>
<id>myProfile</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<groups>${it.groups}</groups>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>当我运行mvn integration-test -PmyProfile时,maven首先开始运行spring依赖中提到的默认故障安全执行。然后它会从我的pom中运行插件。
这会导致我的集成测试运行两次。
我不希望使用spring pom中提到的故障安全插件来运行IT。
我该怎么做呢?我不想在我的pom中重新定义插件。
我只想删除spring-starter pom.xml中提到的目标
发布于 2019-09-02 14:57:42
我看你找到解决问题的办法了。您可以忽略父插件,如here所示。
注意:<phase>none</phase>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<phase>none</phase>
</execution>
</executions>
</plugin>呼叫配置文件myProfile将按预期运行和运行。
https://stackoverflow.com/questions/55829521
复制相似问题