gradle issue“main”groovy.lang.MissingPropertyException:没有这样的属性:baseDir for class:org.apache.catalina.core.StandardEngine

时间:2017-04-05 12:04:05

标签: tomcat gradle spring-boot gretty

这可能是一个简单的问题,但我现在没有看到它。

我运行的命令是gradlew.bat appRun --stacktrace 我的期望:我将拥有一个正在运行的Web应用程序。 (或者至少没有收到任何错误消息)

我的实际:我收到一条说明

的堆栈跟踪错误消息

“main”groovy.lang.MissingPropertyException:没有这样的属性:类的baseDir:org.apache.catalina.core.StandardEngine

这是我的构建脚本

buildscript {
repositories {
    maven {
        url "https://plugins.gradle.org/m2/"
    }
}
dependencies {
    classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE"
}

}

apply plugin: 'org.springframework.boot'
apply plugin: 'java'
apply plugin: 'war'
apply from: 'gretty.plugin'
apply plugin: 'idea'

group 'com.mycom'
version tpos_version
description 'TPOS'


idea {
    project {
    languageLevel = '1.8'
    }
    module {
        downloadJavadoc = true
        downloadSources = true
    }
}
sourceCompatibility = 1.8
targetCompatibility = 1.8


gretty {
    httpPort = 9070
    contextPath = 'rus-tpos'
    servletContainer = 'tomcat7'
    realm = 'auth'
    realmConfigFile = 'tomcat-users.xml'
}



repositories {
    mavenLocal()
    maven {
        url nexusReadRepoUrl
        credentials {
        username nexusReadUsrName
        password nexusReadUsrPwd
        }
    }
    jcenter()

}


configurations.all {
exclude group: 'commons-logging', module: 'commons-logging'
}

dependencies {
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: spring_boot_version
compile group: 'org.springframework.boot', name: 'spring-boot-configuration-processor', version: spring_boot_version
compile group: 'org.springframework.hateoas', name: 'spring-hateoas', version: '0.23.0.RELEASE'

providedRuntime group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version: spring_boot_version
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: spring_boot_version

compile group: 'org.yaml', name: 'snakeyaml', version: '1.18'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'

compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile group: 'com.google.guava', name: 'guava', version: '16.0'
compile group: 'com.jayway.jsonpath', name:'json-path', version:'2.2.0'

compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jackson_version
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jackson_version
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: jackson_version

compile group: 'io.springfox', name: 'springfox-swagger2',version: '2.6.1'
compile group: 'io.springfox', name: 'springfox-swagger-ui',version: '2.6.1'

compile group: 'io.springfox', name:'springfox-petstore',version: '2.6.1'

testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
testCompile group: 'junit', name: 'junit', version: '4.12'
}

processResources {
expand("application.version": version)
}

我认为它处理tomcat可能是行

 providedRuntime group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version: spring_boot_version

或在gretty部分,但不确定请让我知道我应该提供什么,并感谢任何帮助

1 个答案:

答案 0 :(得分:-1)

自从我上次看过这个问题已经有一段时间了,但是我认为这是由于家庭目录中的gradle.properties没有值。我相信这解决了这个问题,但不能记住