2014-12-31 48 views
0

我是新來的gradle,我不明白插件是如何工作的。gradle貨物插件脫機

我想使用貨物插件而不使用maven倉庫,但從http://mvnrepository.com/artifact/cargo/cargo/0.6下載jar文件並將其放入我的lib文件夾中。

我的構建文件:

apply plugin: 'war' 
apply plugin: 'cargo' 

configurations { 
    weblogic 
} 

def Properties tomcatDeployProps = new Properties() 
tomcatDeployProps.load(new FileInputStream(project.file("src/conf/tomcat-deploy.properties"))) 


buildscript { 
    repositories { 
     flatDir dirs: "${rootProject.projectDir}/libs" 
    } 

    dependencies { 
     classpath 'org.gradle.api.plugins:cargo:0.6' 
    } 
} 


dependencies { 

    cargo 'cargo:cargo:0.6' 

} 

這是一個多重配置,這是的build.gradle中的一個子項目。

當我運行

$ gradle tasks 
* Config properties 
     > environment  : tst 
     > dbPropsFile  : C:\developer\projects\FINEOS\fineos8.1\branches\dev\ServiceMonitor\conf\tst-db.properties 
     > deployPropsFile : C:\developer\projects\FINEOS\fineos8.1\branches\dev\ServiceMonitor\conf\tst-deploy.properties 
     > casetypePropsFile : C:\developer\projects\FINEOS\fineos8.1\branches\dev\ServiceMonitor\conf\etc\bo-mappings\tst-casetype.properties 
     > tasktypePropsFile : C:\developer\projects\FINEOS\fineos8.1\branches\dev\ServiceMonitor\conf\etc\bo-mappings\tst-tasktype.properties 

FAILURE: Build failed with an exception. 

* Where: 
Build file 'C:\developer\projects\FINEOS\fineos8.1\branches\dev\ServiceMonitor\ecrm-webapp\build.gradle' line: 3 

* What went wrong: 
A problem occurred evaluating project ':ecrm-webapp'. 
> Failed to apply plugin [id 'cargo'] 
    > Plugin with id 'cargo' not found. 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 2.091 secs 

有人可以幫助我在這個插件以正確的方式配置? 由於

回答

0

假設gradle這個-貨物插件-0.6.1.jarLIB文件夾下面的build.gradle腳本應用於貨物插件放置:

buildscript { 
    dependencies { 
     classpath fileTree('lib') 
    } 
} 

apply plugin: 'java' 
apply plugin: 'cargo' 

cargo { 
    containerId = 'tomcat6x' 
} 
+0

沒」 t工作,給我同樣的錯誤 – carlitos081

+0

什麼'(「$ {rootProject.projectDir}/libs」)'評估?你確定提到的jar文件位於lib目錄嗎? – Opal

+0

由於libs位於rootProject中。無論如何,我也試過'fileTree('libs')',但我仍然有相同的錯誤 – carlitos081