Build waits at Jetty start when running integration tests

感情迁移 提交于 2019-12-20 04:23:36

问题


I'm trying to run some integration / acceptance tests.

I want to run these tests only when passed an environment variable, and so I use the following command:

mvn clean install -Denv="acceptance"

But the build stops at

2015-09-28 18:56:19.273:INFO:oejsh.ContextHandler:main: Started o.e.j.m.p.JettyWebAppContext@4bbc9862{/,file:///home/stephane/dev/java/projects/kahoot-rest/src/main/webapp/,AVAILABLE}{file:///home/stephane/dev/java/projects/kahoot-rest/src/main/webapp/}
2015-09-28 18:56:19.419:INFO:oejs.ServerConnector:main: Started ServerConnector@26b4acf4{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2015-09-28 18:56:19.423:INFO:oejs.Server:main: Started @171829ms
[INFO] Started Jetty Server

I'm using Java 1.8.

My pom.xml file:

    <profile>
        <id>acceptance</id>
        <activation>
            <property>
                <name>env</name>
                <value>acceptance</value>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>failsafe-maven-plugin</artifactId>
                    <version>2.4.3-alpha-1</version>
                    <configuration>
                        <includes>
                            <include>**/acceptance/*.java</include>
                        </includes>
                        <excludes>
                            <exclude>**/*$*</exclude>
                        </excludes>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-maven-plugin</artifactId>
                    <version>9.3.4.RC0</version>
                    <executions>
                        <execution>
                            <id>start-jetty</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>stop-jetty</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>stop</goal>
                            </goals>
                            <configuration>
                                <stopKey>stop</stopKey>
                                <stopPort>8081</stopPort>
                            </configuration>
                        </execution>
                    </executions>
                    <configuration>
                        <scanIntervalSeconds>10</scanIntervalSeconds>
                        <connectors>
                            <connector implementation="org.eclipse.jetty.nio.SelectChannelConnector">
                                <port>8080</port>
                                <maxIdleTime>60000</maxIdleTime>
                            </connector>
                        </connectors>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

回答1:


change

<goal>run</goal>

to

<goal>start</goal>

and add daemon option

<configuration>
    <daemon>true</daemon>
</configuration>


来源:https://stackoverflow.com/questions/32828271/build-waits-at-jetty-start-when-running-integration-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!