Webserver für Frontend-Tests automatisch starten / stoppen

Jetzt starte ich separat eingebetteten Kater via Maven:

mvn tomcat7:run

Und dann laufen diemvn test Tor. Meine Frage ist, kann ich maven konfigurieren, um das automatisch zu tun?tomcat muss gestartet werden, bevor alle Tests ausgeführt und dann gestoppt werden.

Die folgende Maven-Konfiguration für das Tomcat-Plugin wird verwendet:

        <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>

Ich habe versucht, die Plugin-Konfiguration zu aktualisieren:

    <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>

Aber es hat nicht geholfen

Antworten auf die Frage(1)

Ihre Antwort auf die Frage