You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Peter Maas <pf...@gmail.com> on 2009/11/13 11:35:01 UTC

running scala application from buildr

Hi all,

I'm experimenting with scala 2.8 / buildr 1.4.0 a bit... and am really pleased with the results. I wondered however whether it is possible to start my scala application via buildr using a classpath provided by buildr.

Any thoughts? Anyone done this before?

regards,

Peter

Re: running scala application from buildr

Posted by Peter Maas <pm...@finalist.com>.
I managed to do this using the existing Java command as described in the wiki for running embedded jetty:

  task :run => :compile do
  	Java::Commands.java('com.log4p.Main', :classpath => compile.dependencies + [compile.target.to_s])
  end

-P


On Nov 13, 2009, at 11:35 AM, Peter Maas wrote:

> Hi all,
> 
> I'm experimenting with scala 2.8 / buildr 1.4.0 a bit... and am really pleased with the results. I wondered however whether it is possible to start my scala application via buildr using a classpath provided by buildr.
> 
> Any thoughts? Anyone done this before?
> 
> regards,
> 
> Peter


Re: running scala application from buildr

Posted by Daniel Spiewak <dj...@gmail.com>.
This is a much better way of doing it, I just didn't feel up to actually
looking up the API for Java::Commands.  Go with your solution rather than
mine!

Daniel

On Fri, Nov 13, 2009 at 8:59 AM, Peter Maas <pf...@gmail.com> wrote:

> Yeah, I figured out something similar:
>
>  task :run => :compile do
>        Java::Commands.java('com.log4p.Main', :classpath =>
> compile.dependencies + [compile.target.to_s])
>  end
>
>
> On Nov 13, 2009, at 3:54 PM, Daniel Spiewak wrote:
>
> > I generally create a task something like the following (warning: off the
> top
> > of my head and untested):
> >
> > define 'my-project' do
> >  ...
> >
> >  task :run => compile do
> >    cp = (compile.dependencies + compile.into).map(&:to_s).join
> > File::PATH_SEPARATOR
> >    system 'java', '-cp', cp, 'com.company.app.Main'
> >  end
> > end
> >
> > Invoke this task using `buildr my-project:run` and everything should be
> > dandy.
> >
> > Daniel
> >
> > On Fri, Nov 13, 2009 at 4:35 AM, Peter Maas <pf...@gmail.com> wrote:
> >
> >> Hi all,
> >>
> >> I'm experimenting with scala 2.8 / buildr 1.4.0 a bit... and am really
> >> pleased with the results. I wondered however whether it is possible to
> start
> >> my scala application via buildr using a classpath provided by buildr.
> >>
> >> Any thoughts? Anyone done this before?
> >>
> >> regards,
> >>
> >> Peter
>
>

Re: running scala application from buildr

Posted by Peter Maas <pf...@gmail.com>.
Yeah, I figured out something similar:

  task :run => :compile do
  	Java::Commands.java('com.log4p.Main', :classpath => compile.dependencies + [compile.target.to_s])
  end


On Nov 13, 2009, at 3:54 PM, Daniel Spiewak wrote:

> I generally create a task something like the following (warning: off the top
> of my head and untested):
> 
> define 'my-project' do
>  ...
> 
>  task :run => compile do
>    cp = (compile.dependencies + compile.into).map(&:to_s).join
> File::PATH_SEPARATOR
>    system 'java', '-cp', cp, 'com.company.app.Main'
>  end
> end
> 
> Invoke this task using `buildr my-project:run` and everything should be
> dandy.
> 
> Daniel
> 
> On Fri, Nov 13, 2009 at 4:35 AM, Peter Maas <pf...@gmail.com> wrote:
> 
>> Hi all,
>> 
>> I'm experimenting with scala 2.8 / buildr 1.4.0 a bit... and am really
>> pleased with the results. I wondered however whether it is possible to start
>> my scala application via buildr using a classpath provided by buildr.
>> 
>> Any thoughts? Anyone done this before?
>> 
>> regards,
>> 
>> Peter


Re: running scala application from buildr

Posted by Daniel Spiewak <dj...@gmail.com>.
I generally create a task something like the following (warning: off the top
of my head and untested):

define 'my-project' do
  ...

  task :run => compile do
    cp = (compile.dependencies + compile.into).map(&:to_s).join
File::PATH_SEPARATOR
    system 'java', '-cp', cp, 'com.company.app.Main'
  end
end

Invoke this task using `buildr my-project:run` and everything should be
dandy.

Daniel

On Fri, Nov 13, 2009 at 4:35 AM, Peter Maas <pf...@gmail.com> wrote:

> Hi all,
>
> I'm experimenting with scala 2.8 / buildr 1.4.0 a bit... and am really
> pleased with the results. I wondered however whether it is possible to start
> my scala application via buildr using a classpath provided by buildr.
>
> Any thoughts? Anyone done this before?
>
> regards,
>
> Peter