# Jetty Server Configuration

**URL:** <https://discuss.gradle.org/t/jetty-server-configuration/7027>\
**Category:** Old Forum Archive\
**Created:** [August 3, 2012, 6:25pm UTC](https://discuss.gradle.org/t/jetty-server-configuration/7027 "2012-08-03T18:25:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![vivek\_prasad](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vivek_prasad/32/430_2.png) [@vivek\_prasad](https://discuss.gradle.org/u/vivek_prasad)\
**Post date:** [August 3, 2012, 6:25pm UTC](https://discuss.gradle.org/t/jetty-server-configuration/7027/1 "2012-08-03T18:25:00Z")

</div>

I want to configure Jetty for my project. I have never configured the jetty server myself.

Can anyone please tell me how to make a hot deployment on the jetty server.i dont want to make a war .

a sample will help a lot…

---

<div class="post-metadata">

**Author:** ![vivek\_prasad](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vivek_prasad/32/430_2.png) [@vivek\_prasad](https://discuss.gradle.org/u/vivek_prasad)\
**Post date:** [August 4, 2012, 1:34pm UTC](https://discuss.gradle.org/t/jetty-server-configuration/7027/2 "2012-08-04T13:34:00Z")

</div>

anybody please reply

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [August 4, 2012, 8:00pm UTC](https://discuss.gradle.org/t/jetty-server-configuration/7027/3 "2012-08-04T20:00:00Z")

</div>

first of all you should configure your project and the according build file as described in the war plugin chapter: [http://gradle.org/docs/current/userguide/userguide\_single.html#webQuickstart](http://gradle.org/docs/current/userguide/userguide_single.html#webQuickstart) this means, \* put your java sources in the correct folder (default src/main/java)

- put your web resources into the correct webapp folder (default src/main/webapp) \* now you can apply the jetty plugin \* now run jettyRun in the console (starts jetty on default port 8080) \* open your browser on localhost:8080

Everything I just listed here is described in detail in the gradle userguide. Furthermore, the gradle -all distribution contains a complete and executable example in the samples/webApplication/quickstart folder.

cheers, René

---

<div class="post-metadata">

**Author:** ![vivek\_prasad](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vivek_prasad/32/430_2.png) [@vivek\_prasad](https://discuss.gradle.org/u/vivek_prasad)\
**Post date:** [August 6, 2012, 4:16am UTC](https://discuss.gradle.org/t/jetty-server-configuration/7027/4 "2012-08-06T04:16:00Z")

</div>

Hi Rene,

What should i do if my directory structure is different

I have my java source in /src/java

and web resources in l

/WebContent

is there any way to define a different directory structure for jetty.

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [August 6, 2012, 5:12am UTC](https://discuss.gradle.org/t/jetty-server-configuration/7027/5 "2012-08-06T05:12:00Z")

</div>

As you can read in the userguide ([http://gradle.org/docs/current/userguide/userguide\_single.html#N12AEC](http://gradle.org/docs/current/userguide/userguide_single.html#N12AEC)) you just need to configure the webAppDirName property introduced by the war plugin to point to “WebContent”. that should do the trick.

cheers, René

---

<div class="post-metadata">

**Author:** ![vivek\_prasad](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vivek_prasad/32/430_2.png) [@vivek\_prasad](https://discuss.gradle.org/u/vivek_prasad)\
**Post date:** [August 6, 2012, 6:03am UTC](https://discuss.gradle.org/t/jetty-server-configuration/7027/6 "2012-08-06T06:03:00Z")

</div>

how should i write to configure webAppDirName

I tried \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

apply plugin: ‘jetty’ apply plugin: ‘war’

… … …

war{ webAppDirName ‘WebContent’ }

* * *

i tried in other ways too like

webAppDirName=‘WebContent’

and many more

can you please correct me .

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [August 6, 2012, 7:27am UTC](https://discuss.gradle.org/t/jetty-server-configuration/7027/7 "2012-08-06T07:27:00Z")

</div>

webAppDirName is a convention property brought to you by the war plugin. a convention property is directly wired with the project (simplified: a build file is a representation of an Project object) this means you should set the webAppDirName=‘WebContent’

```gradle
apply plugin: 'jetty'
 apply plugin: 'war'
...
webAppDirName = 'WebContent'

```

everything within the war closure (war { }) is delegated to the war task itself (which is a specialization of the jar task).

BTW. you can use **code** html tags to format your code snippets here in the forum.

cheers, René

---

<div class="post-metadata">

**Author:** ![vivek\_prasad](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vivek_prasad/32/430_2.png) [@vivek\_prasad](https://discuss.gradle.org/u/vivek_prasad)\
**Post date:** [August 6, 2012, 7:57am UTC](https://discuss.gradle.org/t/jetty-server-configuration/7027/8 "2012-08-06T07:57:00Z")

</div>

thanks Rene.
