0

I am using the tomcat7-maven-plugin to produce a jar that I can run containing one or more wars with appropriate configurations.

I'd like to start this jar prior to running integration tests and stop it when I'm done. I know the failsafe plugin is the way to go on the tests and it seems that typically you would use the cargo plugin to start an appserver and deploy your war(s). I'd like to run my jar instead of using cargo for more realistic testing.

How can I start my jar at the beginning of the test and stop at when I'm done? Ideally, I'd like to do this using plugins rather than having to write code myself.

brabster
  • 42,504
  • 27
  • 146
  • 186
  • Why do you created jar instead of war cause you are using a servlet engine like tomcat? The typical packaging type is war and not jar. – khmarbaise Nov 12 '12 at 12:50
  • I want to have everything required to run my webapp under version control and I want to be able to deploy it autonomously anywhere (given a suitable JRE) anytime. I do not want to require an appserver to be available and pre-configured. – brabster Nov 12 '12 at 14:00
  • If you don't like to have a appserver/servlet engine available you can't do any kind of testing. Furthermore what is the relationship with the packaging and version control? You can do complete integration testing with cargo plugin as you already mentioned via maven failsafe plugin. You can take a look at: http://khmarbaise.github.com/maui/it-example-container.html how to do this. And what is the problem with using cargo plugin in relationship with more realistic testing? What does "more realistic" mean in your words? – khmarbaise Nov 12 '12 at 14:38
  • The appserver is available - it is packaged and configured in the jar. Suggest to read the tomcat7-maven-plugin link I provided to the exec-war-only goal , the appserver is embedded. Thus, running the app from the jar, instead of using another plugin that may not be configured quite the same, is more realistic. Packaging and version control is done directly via pom & config files in a project. – brabster Nov 12 '12 at 15:32

0 Answers0