Jetty Server Configuration

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…

anybody please reply

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 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é

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.

As you can read in the userguide (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é

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 .

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’

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é

thanks Rene.