Pergunta

Estou tentando pelo Tomcat incorporado para iniciar antes dos testes de integração (o meu usa Selenium + JBehave) e pare logo depois.

Aqui está como tentei configurar o maven:

        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.0</version>
            <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>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

Porém, o Tomcat inicia ok quando executo mvn integration-test e parece que não vai deixar minhas histórias correrem...

Alguém pode ajudar?

Foi útil?

Solução

Acho que encontrei a solução.Funciona com a seguinte configuração:

<plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <fork>true</fork>
                </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>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Observe o elemento de configuração adicionado que diz ao Tomcat para bifurcar.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top