Now, I start separately embedded tomcat via maven:
mvn tomcat7:run
And then run the mvn test
goal.
My question is can I configure maven in order to do that automatically?
tomcat
has to be started before all tests run, and then stopped.
The following maven configuration for tomcat plugin is used:
<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've tried to update 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