Hi Assaf,

thanx a lot, now I got it - it's so easy :-)

I also updated the wiki:
http://cwiki.apache.org/confluence/display/BUILDR/How+to+run+jetty

Thanx && cheers,
Martin



On Wed, 2009-07-22 at 02:05 -0700, Assaf Arkin wrote:
> On Tue, Jul 21, 2009 at 1:46 PM, Martin Grotzke <
> [email protected]> wrote:
> 
> > On Tue, 2009-07-21 at 11:02 -0700, Assaf Arkin wrote:
> > > On Tue, Jul 21, 2009 at 2:50 AM, Martin Grotzke <
> > > [email protected]> wrote:
> > >
> > > > Hi Assaf,
> > > >
> > > > thanx for your response! Unfortunately, I don't see how/where to use
> > the
> > > > Jetty.new exactly.
> > > >
> > > > When I just Jetty.new("foo", "http://localhost:8090";) then buildr
> > > > complains about
> > > >  uninitialized constant Jetty
> > >
> > >
> > > Try Buildr::Jetty.new( …
> > Sorry, but I just don't get it. Where shall this go to? I still want to
> > be able to run jetty in two subprojects. What I'm using in one
> > subproject until now is this:
> >
> >    task("jetty"=>[package(:war), jetty.use]) do |task|
> >      jetty.deploy("http://localhost:8080";, task.prerequisites.first)
> >      puts 'Press CTRL-C to stop Jetty'
> >      trap 'SIGINT' do
> >        jetty.stop
> >      end
> >      Thread.stop
> >    end
> >
> > What is required so that I can use different instances of jetty in
> > different subprojects?
> >
> 
> When you call the jetty method, you get a single instance of the Jetty class
> [1].  That's clearly not what you want, so don't call the jetty method --
> create the instance directly and use that instance instead of the one
> returned by the jetty method.  It's just an object and all you need is a
> variable to reference it.
> 
> 
> Assaf
> 
> [1]
> http://github.com/apache/buildr/blob/a25989f6aaa79a25e9727237977cde248918286e/addon/buildr/jetty.rb#L244-246
> 
> 
> >
> >
> > Thanx && cheers,
> > Martin
> >
> >
> >
> > >
> > > To limit namespace pollution, everything is defined in the Buildr
> > namespace.
> > >  A lot of stuff is also conveniently accessible from the global
> > namespace,
> > > so global namespace is good place to look for thing, if not there, try
> > the
> > > Buildr namespace.
> > >
> > > Assaf
> > >
> > >
> > > >
> > > >
> > > > Can you provide a more complete example?
> > > >
> > > > Thanx && cheers,
> > > > Martin
> > > >
> > > >
> > > > On Mon, 2009-07-20 at 20:04 -0700, Assaf Arkin wrote:
> > > > > On Mon, Jul 20, 2009 at 8:57 AM, Martin Grotzke <
> > > > > [email protected]> wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > our project contains several subprojects. Two of them I want to run
> > > > with
> > > > > > jetty, both instances shall be running at the same time.
> > > > > >
> > > > > > To change the port for one of the instances, I use
> > > > > >  jetty.url = "http://localhost:8090";
> > > > > > in the context of one subproject, but this seems to change also the
> > url
> > > > > > for the jetty task defined in the different subproject.
> > > > > >
> > > > > > That's how I define the jetty tasks:
> > > > > >
> > > > > > define "myproj" do
> > > > > >
> > > > > >  define "subprojA" do
> > > > > >    ...
> > > > > >    task("jetty"=>[package(:war), jetty.use]) do |task|
> > > > > >      jetty.deploy("http://localhost:8080";,
> > task.prerequisites.first)
> > > > > >      puts 'Press CTRL-C to stop Jetty'
> > > > > >      trap 'SIGINT' do
> > > > > >        jetty.stop
> > > > > >      end
> > > > > >      Thread.stop
> > > > > >    end
> > > > > >
> > > > > >  end
> > > > > >
> > > > > >  define "subprojB" do
> > > > > >
> > > > > >    jetty.url = "http://localhost:8090";
> > > > > >    task("jetty"=>[package(:war), jetty.use]) do |task|
> > > > > >      jetty.deploy("http://localhost:8090";,
> > task.prerequisites.first)
> > > > > >      puts 'Press CTRL-C to stop Jetty'
> > > > > >      trap 'SIGINT' do
> > > > > >        jetty.stop
> > > > > >      end
> > > > > >      Thread.stop
> > > > > >    end
> > > > > >
> > > > > >  end
> > > > > >
> > > > > > end
> > > > > >
> > > > > > When I run the first jetty with
> > > > > >  buildr myproj:subprojA
> > > > > > it fails with
> > > > > > ...
> > > > > > Starting Jetty at http://localhost:8090
> > > > > > 1 [main] INFO org.mortbay.log - Logging to
> > > > > > org.slf4j.impl.SimpleLogger(org.mortbay.log) via
> > > > org.mortbay.log.Slf4jLog
> > > > > > 15 [main] INFO org.mortbay.log - jetty-6.1.3
> > > > > > 74 [main] INFO org.mortbay.log - Started SocketConnector @
> > > > 0.0.0.0:8090
> > > > > > Jetty started
> > > > > > Buildr aborted!
> > > > > > Connection refused - connect(2)
> > > > > >
> > > > > >
> > > > > > Is it somehow possible to run several jetty instances for different
> > > > > > subprojects?
> > > > >
> > > > >
> > > > > Each time you call the jetty method it will return the same one
> > instance
> > > > of
> > > > > jetty.  The jetty task is run after the buildfile, at which point the
> > > > last
> > > > > value you set to jetty.url is the current value, which happens to be
> > > > 8090.
> > > > >
> > > > > If you want multiple instances, Jetty.new(name, url) and give each
> > one a
> > > > > different URL.  Name is used to namespace the setup/teardown/use
> > task, so
> > > > > you can use the same name for all instances, or pick different one.
> > > > >
> > > > > Assaf
> > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Thanx && cheers,
> > > > > > Martin
> > > > > >
> > > > > >
> > > >
> >

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to