与执行exec-maven-plugin相比,启动jetty-maven-plugin [英] start jetty-maven-plugin than execute exec-maven-plugin

查看:92
本文介绍了与执行exec-maven-plugin相比,启动jetty-maven-plugin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我吗!

我的pom.xml

    "start the jetty server
<plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.14.v20131031</version>
                <executions>
                    <execution>
                        <phase>
                                test
                        </phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                    </execution>

                </executions>
                <configuration>
                    <scanIntervalSeconds>0</scanIntervalSeconds>
                    <connectors>
                        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                            <port>3663</port>
                            <maxIdleTime>60000</maxIdleTime>
                        </connector>
                    </connectors>
                </configuration>
            </plugin>

" run the jasmine unit tests on the jetty server

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <id>PhantomJS Unit Testing</id>
                        <phase>test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>

                    <executable>${basedir}/src/main/webapp/test/phantomjs_framework/phantomjs.exe</executable>

                    <workingDirectory>${basedir}/src/main/webapp/test/phantomjs_framework</workingDirectory>

                    <arguments>
                        <!-- <argument>run_jasmine.js</argument> -->
                        <argument>phantomjs_jasminexml_runner.js</argument>
                        <argument>http://localhost:3663/test/phantomjs_framework/test_runner.html</argument>
                        <argument>${project.build.directory}/surefire-reports</argument>
                    </arguments>
                </configuration>
            </plugin>

这个想法是使用jetty-maven-plugin启动jetty服务器,而不是使用exec-maven-plugin执行茉莉花测试.

The idea is to launch the jetty server using jetty-maven-plugin than execute the jasmine tests using exec-maven-plugin.

当前,我必须执行以下操作:

Currently i have to do the following:

  1. 运行"jetty:运行"以启动码头服务器
  2. 运行"mvn测试"以运行测试

效果很好!

但是:

好吧,我希望只能运行"mvn测试",而码头服务器会自动启动,目前还没有发生,并且测试失败,我必须先手动运行"jetty:run"

Well, i'm hoping to be able to only run "mvn test" and the jetty server will automatically start, currently it does not happen and the tests fails i have to run "jetty:run" manually first

我来回走了,无法正常工作

I went back and forth and couldn't get it to work

请帮忙!! 谢谢你. 凯斯.

Any help please!! Thank you. Kais.

推荐答案

据我所知,您没有使用它是一个集成测试,因此请在test-compile阶段调用jetty-maven-plugin.

From what I can tell you're not using this is an integration test, so invoke the jetty-maven-plugin in the test-compile phase instead.

或者,按照Karl-Heinz的建议,在pre-integration-test阶段进行设置,然后在integration-test阶段使用failsafe-maven-plugin执行测试.

Alternatively, set this up in the pre-integration-test phase, as suggested by Karl-Heinz and then have your tests executed with the failsafe-maven-plugin in the integration-test phase.

这篇关于与执行exec-maven-plugin相比,启动jetty-maven-plugin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆