# Chapter 7. Web Application Quickstart

This chapter is a work in progress.

This chapter introduces some of the Gradle's support for web applications. Gradle provides two plugins for web application developement: the War plugin and the Jetty plugin. The War plugin extends the Java plugin to build a WAR file for your project. The Jetty plugin extends the War plugin to allow you to deploy your web application to an embedded Jetty web container.

## 7.1. Building a WAR file

To build a WAR file, you apply the War plugin to your project:

Example 7.1. War plugin

`build.gradle`

    usePlugin 'war'

Note: The code for this example can be found at `samples/webApplication/quickstart`

This also applies the Java plugin to your project. Running `gradle build` will compile, test and WAR your project. Gradle will look for the source files to include in the WAR file in `src/main/webapp`. Your compiled classes, and their runtime dependencies are also included in the WAR file.

### Groovy web applications

You can combine multiple plugins in a single project, so you can use the War and Groovy plugins together to build a Groovy based web application. The appropriate groovy libraries will be added to the WAR file for you.

## 7.2. Running your web application

To run your web application, you apply the Jetty plugin to your project:

Example 7.2. Running web application with Jetty plugin

`build.gradle`

    usePlugin 'jetty'

This also applies the War plugin to your project. Running `gradle jettyRun` will run your web application in an embedded Jetty web container. Running `gradle jettyRunWar` will build and test the WAR file, and then run it in an embedded web container.

TODO: which url, configure port, uses source files in place and can edit your files and reload.

## 7.3. Summary

You can find out more about the War plugin in Chapter 21, The War Plugin and the Jetty plugin in Chapter 22, The Jetty Plugin. You can find more sample Java projects in the `samples/webApplication` directory in the Gradle distribution.