Gradle build: Removing tasks from the task container is not supported

喜你入骨 提交于 2021-02-07 20:32:31

问题


I am trying to build a Gradle project using the Ubuntu terminal but it is throwing me the following error. I am not finding any valuable solution. I am using gradle6.0.1. Thanks

FAILURE: Build failed with an exception.

  • Where: Script '/home/jamshaid/cas-server/gradle/springboot.gradle' line: 5

  • What went wrong: A problem occurred evaluating the script.

    Removing tasks from the task container is not supported. Disable the tasks or use replace() instead.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

build.grad

buildscript {
    repositories {   
        mavenLocal()
        mavenCentral()
        jcenter()
        maven { url "https://repo.spring.io/libs-milestone" }
        maven { url "https://repo.spring.io/libs-snapshot" }
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        classpath "de.undercouch:gradle-download-task:${project.gradleDownloadTaskVersion}"
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.springBootVersion}"
        classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:${project.jibVersion}"
        classpath "io.freefair.gradle:maven-plugin:${project.gradleMavenPluginVersion}"


    }
}

repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    maven { url "https://build.shibboleth.net/nexus/content/repositories/releases/" }
    maven { url "https://repo.spring.io/milestone/" }
    maven { url "https://repo.spring.io/snapshot/" }
    maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local" }
}

def casServerVersion = project.'cas.version'
def casWebApplicationBinaryName = "cas.war"

project.ext."casServerVersion" = casServerVersion
project.ext."casWebApplicationBinaryName" = casWebApplicationBinaryName

apply plugin: "io.freefair.war-overlay"
apply from: rootProject.file("gradle/tasks.gradle")

apply plugin: "war"
apply plugin: "eclipse"
apply plugin: "idea"

apply from: rootProject.file("gradle/springboot.gradle")
apply from: rootProject.file("gradle/dockerjib.gradle")

dependencies {
    // Other CAS dependencies/modules may be listed here...
     compile "org.apereo.cas:cas-server-support-json-service-registry:${casServerVersion}"
//testCompile group: 'org.apereo.cas', name: 'cas-server-support-json-service-registry', version: '6.1.2'
//runtime group: 'org.apereo.cas', name: 'cas-server-support-jdbc-drivers', version: '6.1.2'

}

tasks.findByName("jibDockerBuild")
    .dependsOn(copyWebAppIntoJib, copyConfigIntoJib)
    .finalizedBy(deleteWebAppFromJib)

tasks.findByName("jib")
    .dependsOn(copyWebAppIntoJib, copyConfigIntoJib)
    .finalizedBy(deleteWebAppFromJib)

configurations.all {
    resolutionStrategy {
        cacheChangingModulesFor 0, "seconds"
        cacheDynamicVersionsFor 0, "seconds"

        preferProjectModules()

        def failIfConflict = project.hasProperty("failOnVersionConflict") && Boolean.valueOf(project.getProperty("failOnVersionConflict"))
        if (failIfConflict) {
            failOnVersionConflict()
        }
    }
}

eclipse {
    classpath {
       downloadSources = true
       downloadJavadoc = true
    }
}

idea {
    module {
        downloadJavadoc = true
        downloadSources = true
    }
}

bootWar {
    entryCompression = ZipEntryCompression.STORED
    overlays {
        // https://docs.freefair.io/gradle-plugins/current/reference/#_io_freefair_war_overlay
        // Note: The "excludes" property is only for files in the war dependency.
        // If a jar is excluded from the war, it could be brought back into the final war as a dependency
        // of non-war dependencies. Those should be excluded via normal gradle dependency exclusions.
        cas {
            from "org.apereo.cas:cas-server-webapp${project.appServer}:${casServerVersion}@war"
            provided = false
            //excludes = ["WEB-INF/lib/somejar-1.0*"]
        }
    }
}


wrapper {
    distributionType = Wrapper.DistributionType.BIN
    gradleVersion ="6.0.1"
}

来源:https://stackoverflow.com/questions/59055441/gradle-build-removing-tasks-from-the-task-container-is-not-supported

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!