Problem with cargo plugin


(sergey.morenets) #1

Hi

I try to use cargo plugin in my build to start web application locally. However I get the strange exception when launching cargoStartLocal task: Cannot get property ‘canonicalPath’ on null object

My build file:

apply plugin: 'war'
apply plugin: 'cargo'
  dependencies {
 def cargoVersion = '1.4.3'
 cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion",
    "org.codehaus.cargo:cargo-ant:$cargoVersion"
}
  cargo {
 containerId = 'tomcat7x'
}
  buildscript {
 repositories {
  mavenCentral()
 }
   dependencies {
  classpath 'org.gradle.api.plugins:gradle-cargo-plugin:0.6.1'
 }
}

(Benjamin Muschko) #2

Two things are missing in your script:

a) I don’t see a definition of repositories to pull the Cargo libraries from. I guess you simply didn’t include this piece of code. b) A minimal configuration for your Cargo container. At the very least you will need to define the home directory of your container or where to download it from. See the following example:

cargo {
    local {
        homeDir = file('/Users/me/dev/apache-tomcat-7.0.42')
    }
}

Currently, the plugin code does not check whether the home directory is actually set. It should be mandatory to avoid the issue you see. Would you mind creating an issue on GitHub for that?


(Benjamin Muschko) #3

Could you fix your immediate problem?