Gradle jettyRun: how does this thing work?
It sounds like you want to start Jetty for in-container integration tests. Besides having a look at the source code these two posts should get you started:
The key feature you are looking for, starting Jetty in the background, is jettyRun.daemon = true
.
What I'm using for integration test in build.gradle
is looks like below. I think this code is simple and intuitive.
test { exclude '**/*IntegrationTest*'}task integrationTest(type: Test) { include '**/*IntegrationTest*' doFirst { jettyRun.httpPort = 8080 // Port for test jettyRun.daemon = true jettyRun.execute() } doLast { jettyStop.stopPort = 8091 // Port for stop signal jettyStop.stopKey = 'stopKey' jettyStop.execute() }}