Cargpo plugin buils failed / could not resolve all depencies

  • What went wrong:
    Execution failed for task ‘:cargoRunLocal’.

Could not resolve all dependencies for configuration ‘:cargo’.
Cannot resolve external dependency org.codehaus.cargo:cargo-core-uberjar:1.4.15 because no repositories are defined.
Required by:
:userregisteration:unspecified
Cannot resolve external dependency org.codehaus.cargo:cargo-ant:1.4.15 because no repositories are defined.
Required by:
:userregisteration:unspecified

My script is below gradle cargoRunLocal

Cargo plug
apply plugin: 'java’
apply plugin: 'eclipse’
apply plugin: ‘com.bmuschko.cargo’

sourceCompatibility = 1.7

buildscript {

repositories {
    jcenter()
    
   
}

dependencies {
    classpath 'com.bmuschko:gradle-cargo-plugin:2.2.1'
    
    
}

}

cargo {
containerId = 'tomcat7x’
port = 8080
println(“start”)
deployable {
context = 'userregisteration’
file = file(‘C:/Users/naresh.vatsal/workspace_spring_jan14/userregisteration/build/libs/userregisteration.war’)

   }
  local {
     homeDir = file('C:/soft/apache-tomcat-7.0.67')
     outputFile = file('C:/soft/apache-tomcat-7.0.67/output.log')
      containerProperties {
        property 'cargo.tomcat.ajp.port', 9099
         }
    }  

}

As indicated by the error message you are not defining a repository for resolving the Cargo dependencies.

Cannot resolve external dependency org.codehaus.cargo:cargo-ant:1.4.15 because no repositories are defined.

What you are missing here is:

repositories {
    mavenCentral()
}

Keep in mind that the repository you defined in your buildscript block is only used for resolving the plugin but not the plugin’s dependencies - in this case Cargo.