2014-12-31 50 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