You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Martin Grotzke <ma...@javakaffee.de> on 2009/02/14 01:37:43 UTC
How to run a webapp in jetty
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
Re: How to run a webapp in jetty
Posted by Martin Grotzke <ma...@javakaffee.de>.
Hi Assaf,
thanx for your example, I added this to the wiki ([1]).
Thanx && cheers,
Martin
[1] http://cwiki.apache.org/confluence/display/BUILDR/How+to+run+jetty
On Mon, 2009-02-16 at 22:42 -0800, Assaf Arkin wrote:
> On Mon, Feb 16, 2009 at 1:07 AM, Martin Grotzke <
> martin.grotzke@javakaffee.de> wrote:
>
> > On Sun, 2009-02-15 at 16:07 -0800, Assaf Arkin wrote:
> > > 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?
> > >
> > >
> > > I personally don't like the build to block, I like to have the shell
> > ready
> > > while the server is running in the background, so I recommend using
> > > jetty:start.
> > Ok. Do you have a complete example so that we could add this to the
> > buildr+jetty howto?
>
>
> Adapted from your example:
>
> task("deploy-app"=>[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)
> end
>
> I renamed the task deploy-app instead of start, and remove the stopping
> part.
>
> Now, in one console do:
>
> $ buildr jetty:start
>
> Switch to a different console and do:
>
> $ buildr deploy-app
>
> Now the app is running and you can access it from the browser. The first
> console is effectively the Jetty log, and you kill Jetty at any time by
> going there and hitting Ctrl-C. The second console gives you a new prompt
> and you can run buildr deploy-app again, test the app using curl, etc.
>
>
> Alternatively, in a single console:
>
> $ buildr jetty:start &
> $ buildr deploy-app
>
> And again this free up the console so you can do more work while your app is
> running inside Jetty. To stop the server:
>
> $ buildr jetty:stop
>
> Assaf
>
>
> >
> > Cheers,
> > Martin
> >
> >
> > >
> > > Assaf
> > >
> > >
> > > >
> > > >
> > > > 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/
Re: How to run a webapp in jetty
Posted by Assaf Arkin <ar...@intalio.com>.
On Mon, Feb 16, 2009 at 1:07 AM, Martin Grotzke <
martin.grotzke@javakaffee.de> wrote:
> On Sun, 2009-02-15 at 16:07 -0800, Assaf Arkin wrote:
> > 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?
> >
> >
> > I personally don't like the build to block, I like to have the shell
> ready
> > while the server is running in the background, so I recommend using
> > jetty:start.
> Ok. Do you have a complete example so that we could add this to the
> buildr+jetty howto?
Adapted from your example:
task("deploy-app"=>[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)
end
I renamed the task deploy-app instead of start, and remove the stopping
part.
Now, in one console do:
$ buildr jetty:start
Switch to a different console and do:
$ buildr deploy-app
Now the app is running and you can access it from the browser. The first
console is effectively the Jetty log, and you kill Jetty at any time by
going there and hitting Ctrl-C. The second console gives you a new prompt
and you can run buildr deploy-app again, test the app using curl, etc.
Alternatively, in a single console:
$ buildr jetty:start &
$ buildr deploy-app
And again this free up the console so you can do more work while your app is
running inside Jetty. To stop the server:
$ buildr jetty:stop
Assaf
>
> Cheers,
> Martin
>
>
> >
> > Assaf
> >
> >
> > >
> > >
> > > 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
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
>
Re: How to run a webapp in jetty
Posted by Martin Grotzke <ma...@javakaffee.de>.
On Sun, 2009-02-15 at 16:07 -0800, Assaf Arkin wrote:
> 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?
>
>
> I personally don't like the build to block, I like to have the shell ready
> while the server is running in the background, so I recommend using
> jetty:start.
Ok. Do you have a complete example so that we could add this to the
buildr+jetty howto?
Cheers,
Martin
>
> Assaf
>
>
> >
> >
> > 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
> > > > > >
> > > > > >
> > > > >
> > > >
> >
Re: How to run a webapp in jetty
Posted by Assaf Arkin <ar...@intalio.com>.
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?
I personally don't like the build to block, I like to have the shell ready
while the server is running in the background, so I recommend using
jetty:start.
Assaf
>
>
> 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
> > > > >
> > > > >
> > > >
> > >
>
Re: How to run a webapp in jetty
Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Mon, 23 Feb 2009, Martin Grotzke wrote:
> With tapestry5 live class reloading this was indeed the case. If you
> show how to use it without using the jetty plugin this would be kind -
> however I have to admit I didn't really investigate since about 1 year
> (at this time it was the case).
Ah, yeah -- if you have some useful functionality that
relies on a specific IDE plugin, then of course it makes
sense to use the plugin. This would indeed be the example
that invalidates my point :)
My knowledge on Tapestry 5 and its live class reloading is
unfortunately very shallow and entirely academic, but it
didn't occur to me that it would depend on the Jetty plugin
(I always had the impression that it was something that
Tapestry would handle internally with special classloaders,
regardless of the servlet container or how it was started).
Best wishes,
Timo
Re: How to run a webapp in jetty
Posted by Martin Grotzke <ma...@javakaffee.de>.
On Mon, 2009-02-23 at 05:49 +0200, Timo Rantalaiho wrote:
> On Thu, 19 Feb 2009, Martin Grotzke wrote:
> > I personally also used the eclipse jetty-plugin in our last project, but
> > this also stopped to work after some update of eclipse and I didn't
> > have/spent the time to find out what the reason is, I just switched to
> > "mvn jetty:run".
>
> An IDE plugin is definitely the worst alternative
That's your point of view :)
> -- I meant
> starting Jetty with a main method of a Java class like any
> Java command-line application. E.g.
>
> http://www.laughingpanda.org/svn/kansanpankki/trunk/src/test/java/org/laughingpanda/kansanpankki/jetty/Jetty.java
>
> > What makes a real difference IMHO is if you have live classreloading
> > working to see changes immediately, without the need to restart anything
> > (I don't know if it's much time, but at least I *feel* faster :)).
>
> That again doesn't have anything to do with how you start
> the container.
With tapestry5 live class reloading this was indeed the case. If you
show how to use it without using the jetty plugin this would be kind -
however I have to admit I didn't really investigate since about 1 year
(at this time it was the case).
Cheers,
Martin
> I can have for example "foo in production
> mode" and "foo in development mode with javarebel" run
> configurations in my IDE, and the latter adds the JavaRebel
> settings on the command-line. Put javarebel.jar in version
> control and the run configuration can be shared.
>
> Best wishes,
> Timo
>
Re: How to run a webapp in jetty
Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Thu, 19 Feb 2009, Martin Grotzke wrote:
> I personally also used the eclipse jetty-plugin in our last project, but
> this also stopped to work after some update of eclipse and I didn't
> have/spent the time to find out what the reason is, I just switched to
> "mvn jetty:run".
An IDE plugin is definitely the worst alternative -- I meant
starting Jetty with a main method of a Java class like any
Java command-line application. E.g.
http://www.laughingpanda.org/svn/kansanpankki/trunk/src/test/java/org/laughingpanda/kansanpankki/jetty/Jetty.java
> What makes a real difference IMHO is if you have live classreloading
> working to see changes immediately, without the need to restart anything
> (I don't know if it's much time, but at least I *feel* faster :)).
That again doesn't have anything to do with how you start
the container. I can have for example "foo in production
mode" and "foo in development mode with javarebel" run
configurations in my IDE, and the latter adds the JavaRebel
settings on the command-line. Put javarebel.jar in version
control and the run configuration can be shared.
Best wishes,
Timo
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
Re: How to run a webapp in jetty
Posted by Daniel Spiewak <dj...@gmail.com>.
For the record, the Jetty Eclipse plugin broke back in 3.1 and there
are no plans to fix it. However, the original author has released a
clean-room replacement under the name of "Run Jetty, Run". Also, I
would expect Jetty-Eclipse integration to improve in the near future
as Jetty has now become an Eclipse sub-project.
I think that it would probably be useful to be able to launch Jetty
from Buildr, particularly with auto-magical JavaRebel integration.
However, I think the main use of this functionality would be for old-
school IDE-less developers. I would likely continue just launching
Jetty from within Eclipse.
Daniel
On Feb 19, 2009, at 7:56 AM, Martin Grotzke <martin.grotzke@javakaffee.de
> wrote:
> On Wed, 2009-02-18 at 23:14 +0200, Timo Rantalaiho wrote:
>> In day-to-day development I don't see much value in running
>> the servlet container with the build tool, except for
>> automated in-container tests (that must work also on build
>> server for example). In that case too sometimes it can be
>> done with e.g. JUnit (Group)Runner that starts and stops
>> Jetty as needed.
> If the servlet container is started using the IDE or the build tool is
> not very important to me / no big difference.
>
> We just want to have a well defined way how to run the application.
> Some
> developers here still use vi or emacs as their (I)DE and therefore
> have
> no jetty-whatever-plugin (or is there one? *g*).
>
> I personally also used the eclipse jetty-plugin in our last project,
> but
> this also stopped to work after some update of eclipse and I didn't
> have/spent the time to find out what the reason is, I just switched to
> "mvn jetty:run".
>
> What makes a real difference IMHO is if you have live classreloading
> working to see changes immediately, without the need to restart
> anything
> (I don't know if it's much time, but at least I *feel* faster :)).
>
> Cheers,
> Martin
>
>
> On Wed, 2009-02-18 at 23:14 +0200, Timo Rantalaiho wrote:
>> On Sun, 15 Feb 2009, Martin Grotzke wrote:
>>> 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.
>>
>> I like to do something like this
>>
>> 0) Get all project dependencies with their sources
>> e.g. buildr clean install idea artifacts:sources
>> ...the dependencies include a fresh version of Jetty
>>
>> 1) develop with your favourite IDE
>>
>> 2) run Jetty programmatically in IDE with something like this
>>
>> http://svn.apache.org/repos/asf/wicket/trunk/wicket-quickstart/src/main/java/org/apache/wicket/quickstart/Start.java
>>
>> ...on javarebel if you want better hotswap than plain Java debug
>> mode
>>
>> 3) only restart Jetty when necessary
>>
>> 4) only repeat 0) when dependencies change (or you are
>> using snapshots)
>>
>> In day-to-day development I don't see much value in running
>> the servlet container with the build tool, except for
>> automated in-container tests (that must work also on build
>> server for example). In that case too sometimes it can be
>> done with e.g. JUnit (Group)Runner that starts and stops
>> Jetty as needed.
>>
>> Best wishes,
>> Timo
>>
Re: How to run a webapp in jetty
Posted by Martin Grotzke <ma...@javakaffee.de>.
On Wed, 2009-02-18 at 23:14 +0200, Timo Rantalaiho wrote:
> In day-to-day development I don't see much value in running
> the servlet container with the build tool, except for
> automated in-container tests (that must work also on build
> server for example). In that case too sometimes it can be
> done with e.g. JUnit (Group)Runner that starts and stops
> Jetty as needed.
If the servlet container is started using the IDE or the build tool is
not very important to me / no big difference.
We just want to have a well defined way how to run the application. Some
developers here still use vi or emacs as their (I)DE and therefore have
no jetty-whatever-plugin (or is there one? *g*).
I personally also used the eclipse jetty-plugin in our last project, but
this also stopped to work after some update of eclipse and I didn't
have/spent the time to find out what the reason is, I just switched to
"mvn jetty:run".
What makes a real difference IMHO is if you have live classreloading
working to see changes immediately, without the need to restart anything
(I don't know if it's much time, but at least I *feel* faster :)).
Cheers,
Martin
On Wed, 2009-02-18 at 23:14 +0200, Timo Rantalaiho wrote:
> On Sun, 15 Feb 2009, Martin Grotzke wrote:
> > 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.
>
> I like to do something like this
>
> 0) Get all project dependencies with their sources
> e.g. buildr clean install idea artifacts:sources
> ...the dependencies include a fresh version of Jetty
>
> 1) develop with your favourite IDE
>
> 2) run Jetty programmatically in IDE with something like this
>
> http://svn.apache.org/repos/asf/wicket/trunk/wicket-quickstart/src/main/java/org/apache/wicket/quickstart/Start.java
>
> ...on javarebel if you want better hotswap than plain Java debug mode
>
> 3) only restart Jetty when necessary
>
> 4) only repeat 0) when dependencies change (or you are
> using snapshots)
>
> In day-to-day development I don't see much value in running
> the servlet container with the build tool, except for
> automated in-container tests (that must work also on build
> server for example). In that case too sometimes it can be
> done with e.g. JUnit (Group)Runner that starts and stops
> Jetty as needed.
>
> Best wishes,
> Timo
>
Re: How to run a webapp in jetty
Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Sun, 15 Feb 2009, Martin Grotzke wrote:
> 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.
I like to do something like this
0) Get all project dependencies with their sources
e.g. buildr clean install idea artifacts:sources
...the dependencies include a fresh version of Jetty
1) develop with your favourite IDE
2) run Jetty programmatically in IDE with something like this
http://svn.apache.org/repos/asf/wicket/trunk/wicket-quickstart/src/main/java/org/apache/wicket/quickstart/Start.java
...on javarebel if you want better hotswap than plain Java debug mode
3) only restart Jetty when necessary
4) only repeat 0) when dependencies change (or you are
using snapshots)
In day-to-day development I don't see much value in running
the servlet container with the build tool, except for
automated in-container tests (that must work also on build
server for example). In that case too sometimes it can be
done with e.g. JUnit (Group)Runner that starts and stops
Jetty as needed.
Best wishes,
Timo
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
Re: How to run a webapp in jetty
Posted by Martin Grotzke <ma...@javakaffee.de>.
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/
Re: How to run a webapp in jetty
Posted by Alex Boisvert <bo...@intalio.com>.
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
> > > > >
> > > > >
> > > >
> > >
>
Re: How to run a webapp in jetty
Posted by Martin Grotzke <ma...@javakaffee.de>.
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
> > > >
> > > >
> > >
> >
Re: How to run a webapp in jetty
Posted by Assaf Arkin <ar...@intalio.com>.
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
> > >
> > >
> >
>
Re: How to run a webapp in jetty
Posted by Martin Grotzke <ma...@javakaffee.de>.
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?
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
> >
> >
>
Re: How to run a webapp in jetty
Posted by Daniel Spiewak <dj...@gmail.com>.
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
>
>
Re: How to run a webapp in jetty
Posted by Martin Grotzke <ma...@javakaffee.de>.
Great, this works:
...
puts "Press CTRL-C to stop Jetty"
trap "SIGINT" do
jetty.stop
end
Thread.stop
...
Thanx && cheers,
Martin
On Sat, 2009-02-14 at 16:55 -0800, Alex Boisvert wrote:
> Maybe Thread.stop instead of Readline::readline ?
>
> alex
>
> On Sat, Feb 14, 2009 at 4:32 PM, Martin Grotzke <
> martin.grotzke@javakaffee.de> wrote:
>
> > Hi Alex,
> >
> > thanx a lot!
> >
> > I added a page for HowTos to the wiki ([1]) with a single HowTo for this
> > use case ([2]).
> >
> > Btw: I have the habit to use ENTER in stdout between requests to be able
> > to see where the logs for the new request start and where they end.
> > Therefore I'd prefer to use CTRL-C to stop the task. I already searched
> > for this and found s.th. like trap('SIGINT') { jetty:stop } and tried
> > this together with a loop of Readlines to prevent the build task from
> > finishing, but this eats my shell - its somehow broken then (e.g. no
> > output shown when typing).
> > What would be the preferred way to stop the task using CTRL-C?
> >
> > Thanx && cheers,
> > Martin
> >
> >
> > [1] http://cwiki.apache.org/confluence/display/BUILDR/Buildr+HowTos
> > [2] http://cwiki.apache.org/confluence/display/BUILDR/How+to+run+jetty
> >
> >
> >
> > On Fri, 2009-02-13 at 18:00 -0800, Alex Boisvert wrote:
> > > Hi Martin,
> > >
> > > The jetty task in Ode is used for live integration tests... so the build
> > > starts jetty, runs many tests and shuts it down.
> > >
> > > If you just want to run your webapp interactively, you can try the
> > > following:
> > >
> > > require 'readline'
> > >
> > > ....
> > >
> > > task("jetty"=>[package(:war), jetty.use]) do |task|
> > > jetty.deploy("http://localhost:8080", task.prerequisites.first)
> > > Readline::readline('[Type ENTER to stop Jetty]')
> > > end
> > >
> > > alex
> > >
> > >
> > > On Fri, Feb 13, 2009 at 4: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
> > > >
> > > >
> > > >
> >
Re: How to run a webapp in jetty
Posted by Alex Boisvert <bo...@intalio.com>.
Maybe Thread.stop instead of Readline::readline ?
alex
On Sat, Feb 14, 2009 at 4:32 PM, Martin Grotzke <
martin.grotzke@javakaffee.de> wrote:
> Hi Alex,
>
> thanx a lot!
>
> I added a page for HowTos to the wiki ([1]) with a single HowTo for this
> use case ([2]).
>
> Btw: I have the habit to use ENTER in stdout between requests to be able
> to see where the logs for the new request start and where they end.
> Therefore I'd prefer to use CTRL-C to stop the task. I already searched
> for this and found s.th. like trap('SIGINT') { jetty:stop } and tried
> this together with a loop of Readlines to prevent the build task from
> finishing, but this eats my shell - its somehow broken then (e.g. no
> output shown when typing).
> What would be the preferred way to stop the task using CTRL-C?
>
> Thanx && cheers,
> Martin
>
>
> [1] http://cwiki.apache.org/confluence/display/BUILDR/Buildr+HowTos
> [2] http://cwiki.apache.org/confluence/display/BUILDR/How+to+run+jetty
>
>
>
> On Fri, 2009-02-13 at 18:00 -0800, Alex Boisvert wrote:
> > Hi Martin,
> >
> > The jetty task in Ode is used for live integration tests... so the build
> > starts jetty, runs many tests and shuts it down.
> >
> > If you just want to run your webapp interactively, you can try the
> > following:
> >
> > require 'readline'
> >
> > ....
> >
> > task("jetty"=>[package(:war), jetty.use]) do |task|
> > jetty.deploy("http://localhost:8080", task.prerequisites.first)
> > Readline::readline('[Type ENTER to stop Jetty]')
> > end
> >
> > alex
> >
> >
> > On Fri, Feb 13, 2009 at 4: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
> > >
> > >
> > >
>
Re: How to run a webapp in jetty
Posted by Martin Grotzke <ma...@javakaffee.de>.
Hi Alex,
thanx a lot!
I added a page for HowTos to the wiki ([1]) with a single HowTo for this
use case ([2]).
Btw: I have the habit to use ENTER in stdout between requests to be able
to see where the logs for the new request start and where they end.
Therefore I'd prefer to use CTRL-C to stop the task. I already searched
for this and found s.th. like trap('SIGINT') { jetty:stop } and tried
this together with a loop of Readlines to prevent the build task from
finishing, but this eats my shell - its somehow broken then (e.g. no
output shown when typing).
What would be the preferred way to stop the task using CTRL-C?
Thanx && cheers,
Martin
[1] http://cwiki.apache.org/confluence/display/BUILDR/Buildr+HowTos
[2] http://cwiki.apache.org/confluence/display/BUILDR/How+to+run+jetty
On Fri, 2009-02-13 at 18:00 -0800, Alex Boisvert wrote:
> Hi Martin,
>
> The jetty task in Ode is used for live integration tests... so the build
> starts jetty, runs many tests and shuts it down.
>
> If you just want to run your webapp interactively, you can try the
> following:
>
> require 'readline'
>
> ....
>
> task("jetty"=>[package(:war), jetty.use]) do |task|
> jetty.deploy("http://localhost:8080", task.prerequisites.first)
> Readline::readline('[Type ENTER to stop Jetty]')
> end
>
> alex
>
>
> On Fri, Feb 13, 2009 at 4: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
> >
> >
> >
Re: How to run a webapp in jetty
Posted by Alex Boisvert <bo...@intalio.com>.
Hi Martin,
The jetty task in Ode is used for live integration tests... so the build
starts jetty, runs many tests and shuts it down.
If you just want to run your webapp interactively, you can try the
following:
require 'readline'
....
task("jetty"=>[package(:war), jetty.use]) do |task|
jetty.deploy("http://localhost:8080", task.prerequisites.first)
Readline::readline('[Type ENTER to stop Jetty]')
end
alex
On Fri, Feb 13, 2009 at 4: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
>
>
>