0

I'm new with gradle and I didn't understand how the plugin works.

I'm trying to use cargo plugin without use maven repository but downloading the jar file from http://mvnrepository.com/artifact/cargo/cargo/0.6 and put it into my lib folder.

my build file is:

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'

}

This is a multiproject configuration and this build.gradle is in a subproject.

When I run

$ 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

Can Someone help me to configure in the right way this plugin? Thanks

carlitos081
  • 151
  • 1
  • 13

1 Answers1

0

Assuming that gradle-cargo-plugin-0.6.1.jar is placed under lib folder the following build.gradle script applies cargo plugin:

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

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

cargo {
    containerId = 'tomcat6x'
}
Opal
  • 81,889
  • 28
  • 189
  • 210
  • What does `("${rootProject.projectDir}/libs")` evaluate to? Are you sure that mentioned jar file is located in lib dir? – Opal Dec 31 '14 at 14:59
  • Because libs is located in rootProject. Anyway I tried with `fileTree('libs')` too but I still have the same error – carlitos081 Dec 31 '14 at 15:07
  • I don't know the project layout and configuration but it seems that dependencies from folder are not resolved correctly. Do You have this project hosted online? May I have a try? – Opal Dec 31 '14 at 15:18
  • Unfortunately is not online but I did a task to test the path I'm using and it works: `task printDebug << { println tomcatDeployProps.get("tomcat.home") copy{ from "${rootProject.projectDir}/libs/cargo-0.6.jar" into "${rootProject.projectDir}/test" } println "${rootProject.projectDir}/libs" }` – carlitos081 Dec 31 '14 at 15:51
  • So you managed to apply cargo plugin? If so please accept the answer. – Opal Dec 31 '14 at 15:59
  • No I didn't I mean `("${rootProject.projectDir}/libs")` worked – carlitos081 Jan 01 '15 at 22:20