How to override default packaging when using war/jetty plugin?


(Taha Hafeez) #1

Hello everybody

I usually configure my integration tests for my libraries(web based) by using src/test/webapp as the webapp directory. This also allows to me run the instance using jetty plugin(jettyRun) by changing the plugin configuration

jettyRun {
    classpath += files(new File("build/classes/test")) + project.configurations.testRuntime
    webAppSourceDirectory = new File("src/test/webapp")
}

Now this works fine but if I try to upload the archives(using mavin plugin), gradle packages it as a war (understandable as I am using jetty plugin which depends on war).

Can I override it to publish the library as a jar ?

Thanks Tawus


(Luke Daley) #2

The simplest way would be to make this a multi project build, with one project being the plain jar and the other being the integration testing harness.

It’s possible to do it all in one project, but the two project approach would be simpler and IDEs cope much better with it.

Would that suffice?


(Taha Hafeez) #3

Thanks Luke

Doesn’t seem to be the best of solutions :slight_smile: but thanks anyways.

Would appreciate any pointers for doing it in a single project.


(Luke Daley) #4

Do you need IDE support?


(Taha Hafeez) #5

Thanks for the quick reply.

No, I don’t need IDE support. I use intellj idea and the support for gradle is not that good for now. So I usually run the tests (gradle test) or jetty(gradle jettyRun) from the command line.