gpt4 book ai didi

java - 如何在开始测试之前运行tomcat

转载 作者:太空宇宙 更新时间:2023-11-04 12:41:34 24 4
gpt4 key购买 nike

经过两天的搜索,我在测试之前仍然无法运行tomcat,谁能告诉我我做错了什么?这是我的 pom

 <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.16</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<server>tomcat-development-server</server>
<port>8081</port>
<path>/test</path>
</configuration>
<executions>
<execution>
<id>start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>stop-tomcat</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>

当我使用 mvn 验证我的测试开始时,但服务器没有,我不知道我错过了什么!

最佳答案

我通过在预集成测试阶段添加此代码解决了问题

<configuration>
<fork>true</fork>
</configuration>

关于java - 如何在开始测试之前运行tomcat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36790317/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com