我正试图用gradle货把war部署到tomcat,我得到的错误找不到方法cargo()
C:\Users\naresh.vatsal\workspace_spring_jan14\SpringMvcUsingGradle>gradle构建 失败:生成失败,出现异常。 其中:构建文件'C:\Users\naresh.vatsal\workspace_spring_jan14\SpringMvcUsingGradle\build.gradle‘行: 45 出了问题:评估根项目'SpringMvcUsingGradle‘时出现了一个问题。 无法为根项目'SpringMvcUsingGradle‘上的参数build_3gitu3al50b7kv8zi1ebj3qsr$runclosure3@302aa00f找到cargo()方法。
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'com.bmuschko.tomcat-base'
apply plugin: 'com.bmuschko.cargo-base'
ext.tomcatVersion = '7.0.67'
sourceCompatibility = 1.7
buildscript {
repositories {
maven {
url "https://plugins.grdev.net/m2/"
}
}
dependencies {
classpath "com.bmuschko:gradle-tomcat-plugin:2.2.4"
classpath 'com.bmuschko:gradle-cargo-plugin:2.2'
}
}
repositories {
mavenCentral()
}
dependencies {
def cargoVersion = '1.4.5'
cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion",
"org.codehaus.cargo:cargo-ant:$cargoVersion"
compile 'org.springframework:spring-context:4.0.0.RELEASE'
compile 'org.springframework:spring-webmvc:4.0.0.RELEASE'
compile 'org.aspectj:aspectjrt:1.7.4'
compile 'javax.inject:javax.inject:1'
compile 'javax.servlet:jstl:1.2'
compile 'org.slf4j:slf4j-api:1.7.5'
compile 'org.slf4j:jcl-over-slf4j:1.7.5'
compile 'org.slf4j:slf4j-log4j12:1.7.5'
compile 'log4j:log4j:1.2.15'
testCompile 'junit:junit:4.7'
}
cargo {
containerId = 'tomcat7x'
port = 8080
local {
homeDir = file('C:/mdi/soft/apache-tomcat-7.0.67')
output = file('C:/mdi/soft/apache-tomcat-7.0.67/output.log')
}
}
war {
version = ''
}发布于 2016-01-20 08:48:28
现在看来,你使用的插件是错误的。只要改变:
apply plugin: 'com.bmuschko.cargo-base'至
apply plugin: 'com.bmuschko.cargo'因为,当您应用com.bmuschko.cargo-base插件时,您必须根据插件描述配置每个任务。
另外,没有属性output,它可以在local闭包中定义,但是有一个outputFile属性,因此,您的local闭包应该如下所示:
local {
homeDir = file('C:/mdi/soft/apache-tomcat-7.0.67')
outputFile = file('C:/mdi/soft/apache-tomcat-7.0.67/output.log')
}https://stackoverflow.com/questions/34891949
复制相似问题