2012-09-12 106 views
2

我想寫一個Grails腳本來構建和部署(SCP),我的應用程序:的Grails腳本部署戰爭

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

任何想法?

+0

你試過把它lib文件夾中的項目的根目錄下(如果不存在,創建它)? – rascio

回答

4

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

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

非常感謝Aram,它的工作! – Yann