不推荐使用ProjectDependency.getProjectConfiguration()方法

时间:2019-03-10 09:39:09

标签: gradle

当我使用命令构建项目时(3.5级):

./gradlew -p web -x test build

输出为:

The ProjectDependency.getProjectConfiguration() method has been deprecated and is scheduled to be removed in Gradle 4.0.
ModuleDependency.getConfiguration() has been deprecated and is scheduled to be removed in Gradle 4.0. Use ModuleDependency.getTargetConfiguration() instead.

我检查了项目并且无处调用此方法。如何更改build.gradle来解决此问题?

这是我的gradle.build:

group 'dolphin'
version '1.0-SNAPSHOT'

buildscript {
    ext {
        springBootVersion = '1.4.5.RELEASE'
        springVersion = '4.3.7.RELEASE'
        springfoxVersion = '2.6.1'
        jacksonVersion = '2.8.7'
        lombokVersion = '1.16.14'
    }
    ext['tomcat.version'] = '8.0.35'

    repositories {
        mavenCentral()
        jcenter{
            url 'http://jcenter.bintray.com'
        }
    }

    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")

    }
}

def getVersionCode() {
    def versionFile = file("$rootDir/version.properties")
    if (!versionFile.canRead()) {
        throw new GradleException("Could not find version.properties!")
    }
    def versionProps = new Properties()
    versionProps.load(new FileInputStream(versionFile))
    def versionCode = versionProps['VERSION'].toString()
    return versionCode
}

repositories {
    mavenCentral()
}


allprojects {
    apply plugin: 'java'
    apply plugin: 'org.springframework.boot'
    repositories {
        mavenCentral()
    }
}


task wrapper(type: Wrapper) {
    description = 'Generates gradlew[.bat] scripts'
    gradleVersion = '3.5'
}


project(":common") {
    description = ''

    dependencies {
        compile("org.springframework:spring-context:" + springVersion)
        compile("commons-codec:commons-codec:1.10")
        compile("org.apache.tomcat:tomcat-juli:" + property('tomcat.version'))
        compile 'org.springframework.boot:spring-boot-starter-web'
        compile("io.springfox:springfox-swagger2:${springfoxVersion}")
        compile group: 'io.swagger', name: 'swagger-annotations', version: '1.5.20'
        compile("org.projectlombok:lombok:${lombokVersion}")
        compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
        compile group: 'org.mybatis.spring.boot', name: 'mybatis-spring-boot-starter', version: '1.3.0'
        compile group: 'org.mybatis', name: 'mybatis', version: '3.4.4'
        compile group: 'org.mybatis', name: 'mybatis-typehandlers-jsr310', version: '1.0.2'
    }
}


project(":composite") {

    description = 'dolphin-composite'

    dependencies {
        compile project(":business")
        compile project(":data")
        compile("org.springframework:spring-context:" + springVersion)
    }
}

project(":web") {

    description = "web"

    jar {
        baseName = "dolphin-web-" + getVersionCode()
    }

    task copyfile() {
    }

    dependencies {
        compile project(':business')
        compile project(':api')
        compile project(':common')
        compile project(':data')
        compile project(':composite')
        compile("com.zaxxer:HikariCP:2.6.0")
        compile("mysql:mysql-connector-java:5.1.24")
        compile("org.springframework.boot:spring-boot-starter-web")
        compile("org.springframework.boot:spring-boot-starter")
        compile group: 'org.apache.tomcat', name: 'tomcat-juli', version: property('tomcat.version')
        compile("org.projectlombok:lombok:1.16.14")
        compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
        compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.24'
        compile group: 'org.mybatis', name: 'mybatis', version: '3.4.2'
        compile group: 'org.mybatis', name: 'mybatis-typehandlers-jsr310', version: '1.0.2'
        testCompile group: 'junit', name: 'junit', version: '4.12'
    }
}

project(":business") {

    description = "business"

    dependencies {
        compile project(':data')
        compile project(':common')
        compile('org.springframework.boot:spring-boot-starter-web')
    }
}

project(":data") {

    description = "data"

    dependencies {
        compile project(':dolphin-mybatis')
        compile project(':common')
        compile("org.projectlombok:lombok:${lombokVersion}")
        compile("com.zaxxer:HikariCP:2.6.0")
        compile group: 'org.postgresql', name: 'postgresql', version: '42.1.4'
        compile("org.hibernate:hibernate-validator:5.2.4.Final")
        compile("org.mybatis.spring.boot:mybatis-spring-boot-starter:1.1.1")
        compile("org.apache.commons:commons-lang3:3.5")
        compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.24'
        compile group: 'org.mybatis', name: 'mybatis', version: '3.4.2'
        compile group: 'org.mybatis', name: 'mybatis-typehandlers-jsr310', version: '1.0.2'
        testCompile group: 'junit', name: 'junit', version: '4.11'
        compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion")

    }
}

project(":dolphin-mybatis") {

    description = "dolphin-mybatis"

    dependencies {

    }
}

0 个答案:

没有答案