我有一个样例springboot java应用程序。这是我的pom文件
<groupId>com.sample.this</groupId>
<artifactId>example</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
</parent>
<profiles>
<profile>
<id>profile1</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>id1</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>当我运行mvn verify -Pprofile1时,故障安全插件运行两次。
这是日志-
[INFO] --- maven-failsafe-plugin:2.22.1:integration-test (default) @ junit.example ---
.
.
.
[INFO] --- maven-failsafe-plugin:2.22.1:integration-test (id1) @ junit.example ---当我删除springboot starter parent pom时,故障安全插件就会像预期的那样运行一次。这是日志-
[INFO] --- maven-failsafe-plugin:2.22.1:integration-test (id1) @ junit.example ---因此,如果在我的pom中找不到,springboot会在集成测试阶段运行其默认的故障安全插件。
我不能在我的故障安全插件声明中添加默认的执行步骤。我如何停止springboot来停止运行它的故障保护插件?
我可以把这个加到我的pom里让它工作-
<execution>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<skipITs>true</skipITs>
</configuration>
</execution>但这看起来并不直观。
有没有别的办法?
我不想在我的pom文件中添加springboot插件
发布于 2019-05-30 14:21:44
请检查以下内容。在这里,默认执行已被禁用:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
</parent>
<profiles>
<profile>
<id>profile1</id>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>default</id>
<phase>none</phase>
</execution>
<execution>
<id>id1</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>发布于 2019-05-30 13:33:42
以下可能是删除groupId和执行id标签的解决方案:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
</parent>
<profiles>
<profile>
<id>profile1</id>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>当使用上述更改执行mvn verify -Pprofile1时,结果如下所示:
[INFO] ------------------------------------------------------------------------
[INFO] Building test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.1:integration-test (default) @ test ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.1:verify (default) @ test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------https://stackoverflow.com/questions/56342788
复制相似问题