Grails 脚本部署 war

标签 grails scp grails-2.0

我正在尝试编写一个 Grails 脚本来构建和部署 (scp) 我的应用程序:

includeTargets << grailsScript("War")

target('deploy': "Deploy war on server") {
  depends(war)
  ant.property ( file : 'application.properties' )
  def user = ant.project.properties."${grailsEnv}_remote_user"
  def host = ant.project.properties."${grailsEnv}_remote_host"
  def dir  = ant.project.properties."${grailsEnv}_remote_dir"
  ant.scp(file: warName, todir: "${user}@${host}:${dir}", passphrase:"", trust:"true")
}
setDefaultTarget('deploy')

当我运行此脚本时,出现以下错误:

C:\Java\IDE\workspaces\Projets\Test 1.5\build.xml:20: Problem: failed to create task or type scp
Cause: Could not load a dependent class com/jcraft/jsch/Logger
  It is not enough to have Ant's optional JARs
  you need the JAR files that the optional tasks depend upon.
  Ant's optional task dependencies are listed in the manual.

当然我下载了jsch.jar,但我找不到如何修改类路径。

我使用 STS 3.0 和 Grails 2.1.0

有什么想法吗?

最佳答案

只需将以下内容添加到您的 BuildConfig.groovy

    dependencies {
        build "com.jcraft:jsch:0.1.46"
        build "org.apache.ant:ant-jsch:1.8.2"
...

关于Grails 脚本部署 war ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12384470/

相关文章:

python - Paramiko/scp - 检查远程主机上是否存在文件

grails - 无法将 GSP 参数绑定(bind)到 Controller 中的命令对象

grails - 如何排除来自Grails 2.4.3中$ GRAILS_HOME/libs/的默认库

json - Grails httpbuilder json响应

amazon-web-services - 试图将文件夹复制到 AWS EC2 实例 : Getting no directory found?

php - SCP 命令行和 PHP exec() 不做同样的事情

grails - 如何根据拒绝访问的原因使Grails的Spring Security Core呈现不同的页面

Grails:g:链接不应用带有动态/GString键的参数

amazon-web-services - 如何从config.groovy文件定义和访问grails中的数组

grails - Grails URL映射优先规则