buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grotzke <martin.grot...@javakaffee.de>
Subject Re: How to run a webapp in jetty
Date Sun, 15 Feb 2009 20:31:49 GMT
Hi Alex,

my goal is also not to restart jetty all the time. In our last project
we used tapestry5 which has built in automatic class and template
reloading, therefore this was solved already. Our next project will
probably be done with wicket, for which I also want to have javarebel
integrated for both class and template reloading. My goal is not to
depend on a local installation of each developer but to have a build
environment that provides the required bits.

Cheers,
Martin


On Sun, 2009-02-15 at 09:01 -0800, Alex Boisvert wrote:
> When I develop, I run Jetty separately since I want to configure other
> aspects not handled by Buildr such as logging, datasources and I want
> minimize the cycle time by not restarting Jetty all the time.  I keep many
> jars in the common libs so they are already JITted and I use JavaRebel to
> dynamically pick up code that changes.   I've essentially created a new
> packaging task that creates an exploded webapp consisting mostly of symlinks
> back into my project's structure (e.g. target/classes, src/main/webapp) and
> symlinks to M2 artifacts.
> 
> It's kinda crude right now ... it short-circuits some Buildr features (such
> as resource filtering), it makes some assumptions about the jars I place in
> common lib and it assumes it runs on an OS that supports symlinks.  Anyway,
> if this sounds interesting to others, I can probably clean it up and share
> it.
> 
> alex
> 
> 
> On Sun, Feb 15, 2009 at 8:26 AM, Martin Grotzke <
> martin.grotzke@javakaffee.de> wrote:
> 
> > Hi Assaf,
> >
> > would you say [1] is the right way to run a webapp in jetty, or is there
> > a better way?
> >
> > Cheers,
> > Martin
> >
> >
> > [1] http://cwiki.apache.org/confluence/display/BUILDR/How+to+run+jetty
> >
> >
> >
> > On Sun, 2009-02-15 at 01:40 -0800, Assaf Arkin wrote:
> > > On Fri, Feb 13, 2009 at 5:37 PM, Martin Grotzke <
> > > martin.grotzke@javakaffee.de> wrote:
> > >
> > > > Hi Daniel,
> > > >
> > > > thanx for your fast reply! At javaworld I found one relevant article
> > > > ([1]), but this does only show (at least AFAICS) how to start jetty
> > > > programmatically from java - what's not what I'm looking for. Am I
> > > > missing s.th. in this article?
> > >
> > >
> > > buildr jetty:start
> > >
> > > This will start Jetty running in the current shell, and you can kill it
> > with
> > > Ctrl-C, or buildr jetty:stop (from a different shell). And of course you
> > can
> > > have your build finish by invoking this task (e.g. after packaging and
> > > deploying the web app).
> > >
> > > If the build does jetty:use, it either uses the running instance, or if
> > > there is no instance, starts a new one and shut it down at the end
> > (useful
> > > for integration tests).
> > >
> > > Assaf
> > >
> > >
> > > >
> > > >
> > > > Thx && cheers,
> > > > Martin
> > > >
> > > >
> > > > [1]
> > > >
> > http://www.javaworld.com/javaworld/jw-12-2007/jw-12-outside-the-ide.html
> > > >
> > > >
> > > > On Fri, 2009-02-13 at 19:04 -0600, Daniel Spiewak wrote:
> > > > > Nathan Hamblin has created a Buildr extension which accomplished
> > > > > this.  I don't have a URL handy, but he did publish it in a JavaWorld
> > > > > article.
> > > > >
> > > > > Daniel
> > > > >
> > > > > On Feb 13, 2009, at 6:37 PM, Martin Grotzke <
> > > > martin.grotzke@javakaffee.de
> > > > >  > wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I have a simple webapp and want to run this with jetty.
> > > > > >
> > > > > > Just running "buildr jetty:start" (with require 'buildr/jetty'
in
> > my
> > > > > > buildfile) starts jetty, but then jetty doesn't serve my webapp.
> > > > > >
> > > > > > From the ode buildfile I found the following:
> > > > > >
> > > > > >  task("start"=>[package(:war), jetty.use]) do |task|
> > > > > >    class << task ; attr_accessor :url, :path ; end
> > > > > >    task.url = "http://localhost:8080/mywebapp"
> > > > > >    task.path = jetty.deploy(task.url, task.prerequisites.first)
> > > > > >    jetty.teardown task("stop")
> > > > > >  end
> > > > > >
> > > > > >  task("stop") do |task|
> > > > > >    if url = task("start").url rescue nil
> > > > > >      jetty.undeploy url
> > > > > >    end
> > > > > >  end
> > > > > >
> > > > > > It seems that I can invoke this with "buildr
> > > > > > mywebapp:start" ("mywebapp"
> > > > > > beeing the name I defined for my project). I see jetty starting
my
> > > > > > webapp, but unfortunately it stops directly afterwards. This
is the
> > > > > > end
> > > > > > of the output:
> > > > > >
> > > > > > ====================
> > > > > > [Completed] Your build has completed: /home/grotzke/proj/mywebapp
> > > > > > buildr mywebapp:start
> > > > > > Completed in 2.625s
> > > > > > Undeploying app at /mywebapp
> > > > > > Jetty server stopped
> > > > > > ====================
> > > > > >
> > > > > > So what is the correct way to run jetty with the deployed webapp?
> > > > > >
> > > > > > Thanx in advance,
> > > > > > cheers,
> > > > > > Martin
> > > > > >
> > > > > >
> > > > >
> > > >
> >
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

Mime
View raw message