命令行 mvn 参数停止 spring-boot-maven-plugin 执行 运行
Command line mvn parameter to stop spring-boot-maven-plugin from executing run
我正在开发一个 Spring 启动应用程序,作为我的 maven 项目集成测试阶段的一部分,我已经配置了 spring-boot maven 插件以在运行期间启动和关闭构建的前和 post 集成测试部分如下:
<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 上,我将 运行 针对已部署服务的外部服务进行测试,我不需要 Spring 在 Jenkins 作业中启动启动应用程序。
有没有办法让我通过 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 引导应用程序将不会作为集成测试的一部分启动。
我正在开发一个 Spring 启动应用程序,作为我的 maven 项目集成测试阶段的一部分,我已经配置了 spring-boot maven 插件以在运行期间启动和关闭构建的前和 post 集成测试部分如下:
<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 上,我将 运行 针对已部署服务的外部服务进行测试,我不需要 Spring 在 Jenkins 作业中启动启动应用程序。
有没有办法让我通过 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 引导应用程序将不会作为集成测试的一部分启动。