Tag: embedded tomcat 7

tomcat7-maven-plugin:运行多个webapps但端口8080已经在使用中

我正在尝试使用tomcat7-maven-plugin来设置嵌入式tomcat容器,在pre-integration-test阶段运行webapps,运行集成测试,然后在post-integration-test阶段关闭tomcat。 该项目是一个多模块maven项目(包含app1 , app2等)。 父pom.xml如下所示, org.apache.tomcat.maven tomcat7-maven-plugin 2.1 path/to/context.xml path/to/tomcat-users.xml true tomcat-run run pre-integration-test tomcat-shutdown shutdown post-integration-test 然后我就运行mvn clean integration-test –projects=app1,app2 。 当第二个应用程序启动时 ,我得到java.net.BindException , SEVERE: Failed to initialize end point associated with ProtocolHandler [“http-bio-8080”] java.net.BindException: Address already in use :8080 at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:406) at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:610) at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:429) at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119) at org.apache.catalina.connector.Connector.initInternal(Connector.java:981) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559) […]

自动启动/停止Web服务器以进行前端测试

现在,我通过maven分别启动嵌入式tomcat: mvn tomcat7:run 然后运行mvn test目标。 我的问题是我可以配置maven以自动执行此操作吗? 必须在所有测试运行之前启动tomcat ,然后停止。 使用以下tomcat插件的maven配置: org.apache.tomcat.maven tomcat7-maven-plugin 2.1 /SpringMvcExample http://localhost:8080/manager/text tomcat7 我试图将插件配置更新为: org.apache.tomcat.maven tomcat7-maven-plugin 2.1 /SpringMvcExample http://localhost:8080/manager/text tomcat7 start-tomcat pre-integration-test run stop-tomcat post-integration-test shutdown 但它没有帮助