Could anyone help me with this!!
My 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>
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:
- run "jetty:run" to start the jetty server
- run "mvn test" to run the tests
it works fine!!
BUT:
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.
pre-integration-testphase and run the integration tests viaexec-maven-pluginin theintegration-testphase and stop the jetty server in thepost-integration-testphase which means you have to bind it appropriately. And than you can callmvn verify. And of course don't try to do that in your war module directory. Best is to create a separate integration test module which contains the appropriate configuration. - khmarbaise