# Deploying Web Projects Locally

Maven can deploy web applications locally by using plugins.

First of all define a property for the deployment context:

```markup
<properties>
   <server.path>/webproject</server.path>
</properties>
```

This will be used to deploy the project into the <http://localhost:8080/webproject/> URL.

### Jetty

When using the [Jetty plugin](https://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html) with Maven use this configuration:

```markup
<plugin>
   <!-- Jetty -->
   <groupId>org.eclipse.jetty</groupId>
   <artifactId>jetty-maven-plugin</artifactId>
   <version>${plugin.jetty.version}</version>
   <configuration>
      <stopKey>STOP</stopKey>
      <stopPort>9999</stopPort>
      <stopWait>5</stopWait>
      <webApp>
         <contextPath>${server.path}</contextPath>
      </webApp>
   </configuration>
</plugin>
```

Afterwards it can be run with:

```bash
mvn jetty:run
```

### Tomcat

When using the [Tomcat plugin](http://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin/) with Maven use this configuration:

```markup
<plugin>
   <!-- Tomcat 7 -->
   <groupId>org.apache.tomcat.maven</groupId>
   <artifactId>tomcat7-maven-plugin</artifactId>
   <version>${plugin.tomcat7.version}</version>
   <configuration>
      <path>${server.path}</path>
   </configuration>
</plugin>
```

Afterwards it can be run with:

```markup
mvn tomcat7:run-war
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bernardo.gitbook.io/development-docs-java/maven/deployments/deploying-web-projects-locally.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
