2

我正在尝试编写一个 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

任何想法 ?

4

1 回答 1

4

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

    dependencies {
        build "com.jcraft:jsch:0.1.46"
        build "org.apache.ant:ant-jsch:1.8.2"
...
于 2012-09-12T11:45:24.977 回答