[英]using spring-boot-maven-plugin with exec classifier, but can't run the app from IDE anymore
[英]Command line mvn parameter to stop spring-boot-maven-plugin from executing run
我正在開發一個Spring Boot應用程序,並且在我的maven項目的Integration Test階段中,我已經配置了spring-boot maven插件,以在構建的集成測試的前期和后期進行以下操作:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
但是,我這樣做只是為了讓我的開發人員可以針對服務的本地實例運行測試。 在Jenkins上,我將對部署了該服務的外部服務運行測試,並且不需要在Jenkins作業中啟動Spring Boot應用程序。
有沒有辦法讓我通過mvn命令行覆蓋明確阻止spring-boot maven插件啟動服務?
當然,您可以為其公開一個屬性,例如
<properties>
<skip.it>false</skip.it>
</properties>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<skip>${skip.it}</skip>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
<configuration>
<skip>${skip.it}</skip>
</configuration>
</execution>
</executions>
</plugin>
一旦有了它,請按如下所示運行命令: mvn verify -Dskip.it=true
並且不會在集成測試中啟動Spring Boot應用程序。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.