Capistrano任务未在cap deploy中运行

时间:2014-08-20 13:19:28

标签: java ruby capistrano

第一次使用capistrano并尝试在远程主机中部署jar文件(或运行jar)

当我运行cap deploy时,我看到没有错误,看起来很成功。但是,我既没有看到jar在远程主机上运行,​​也没有看到maven build和package!

以下是我的deploy.rb,

   namespace :deploy do
    task :deploy do
        puts "==================Building with Maven======================"
        run "cd #{deploy_to}/current"
        run "mvn clean package"
        run "java -jar #{deploy_to}/target/*dependencies.jar &"
    end
   end

不确定它是否正确的方法呢?非常感谢任何建议!

1 个答案:

答案 0 :(得分:2)

尝试以下方法:

  task :some_name do
     puts "==================Building with Maven======================"
     run "cd #{deploy_to}/current && mvn clean package"
     run "nohup java -jar #{deploy_to}/current/target/*dependencies.jar > /dev/null 2>&1 &"
  end

  after "deploy", "some_name"

并运行cap deploy