Now I run separately built-in tomcat via maven:
mvn tomcat7:run
And then run the mvn test target. My question is, can I configure maven to do this automatically? tomcat must be started before all tests are run, and then stopped.
The following maven configuration is used for the tomcat plugin:
<plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <path>/SpringMvcExample</path> <url>http://localhost:8080/manager/text</url> <server>tomcat7</server> </configuration> </plugin> </plugins>
I tried updating the plugin configuration to:
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <path>/SpringMvcExample</path> <url>http://localhost:8080/manager/text</url> <server>tomcat7</server> </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> </plugin>
But it did not help
source share