【发布时间】:2011-02-26 00:16:50
【问题描述】:
我正在尝试从 Maven exec 插件启动 Rails 应用程序。我正在使用./script/rails server 启动服务器并使用kill -9 cat tmp/pids/server.pid 停止服务器。但是 exec 在服务器启动后一直等待。是否可以在后台运行这样的 shell 命令而不等待?有没有更好的方法从 Maven 启动/停止 rails 应用程序?这是我的 pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>start-rails-app</id>
<phase>pre-integration-test</phase>
<configuration>
<executable>script/rails</executable>
<workingDirectory>${rails.app.dir}</workingDirectory>
<arguments>
<argument>server</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>stop-rails-app</id>
<phase>post-integration-test</phase>
<configuration>
<executable>kill -9 `cat tmp/pids/server.pid`</executable>
<workingDirectory>${rails.app.dir}</workingDirectory>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
【问题讨论】:
标签: ruby-on-rails shell deployment maven exec