You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by David Yang <da...@gmail.com> on 2010/09/21 16:35:46 UTC

Running projects after compile/build

I know this has been discussed here (http://groups.google.com/group/buildr-talk/browse_thread/thread/9f3694f43f23a701)

But wanted to open up the issue again:

I've spent the last few years doing Ruby so I'm not super-familiar with how Java handles bundling dependencies (most of what I have seen is Maven's system/local repos, haven't seen how ivy handles anything).  

I have a project that has several deps both in Maven repos and from sub projects - the way I run the Main class right now is:

  define 'router' do
    compile.with transitive(CAMEL, CAMEL_FTP, project('other-project'))
    package(:jar).with :manifest=>manifest.merge('Main-Class'=>'com.company.route.Route')
    
    task :run => :compile do
      puts resources.target
      deps = compile.dependencies + [compile.target] + [resources.target]
      cp = deps.join(":")
      puts cp
      system "java -cp #{cp} com.company.route.Route"
    end
    

Is this the right way to think about it?

Also, if I bundle resources with other projects in jar files, or in this project, how do I add those to the classpath as well?

Sorry for the newbie questions - the above feels gross to me and I'm just wondering if there's something obvious I'm missing.

Thanks,
David