admin管理员组

文章数量:1296261

I am working with the following gradle.build file:

buildscript {
    configurations.classpath {
        exclude module: 'spring-boot-buildpack-platform'
    }
    configurations.all {
        resolutionStrategy {
            eachDependency { details ->
                if (details.requested.group == '.springframework' &&
                    details.requested.name == 'spring-core') {
                    details.useVersion('6.1.0-M5')
                }
            }
        }
    }
}

plugins {
    id 'java'
    id '.springframework.boot' version '3.2.0-M3'
}

group = 'com.demo'
version = '1.0.0-SNAPSHOT'

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
    }
}

repositories {
    maven {
        credentials {
        }
        metadataSources {
            mavenPom()
            artifact()
        }
    }
    maven {
        credentials {
        }
        metadataSources {
            mavenPom()
            artifact()
        }
    }
}

dependencies {
    implementation '.springframework.boot:spring-boot-starter:3.2.0-M3'
    implementation '.springframework.boot:spring-boot-starter-web:3.2.0-M3'
    implementation '.springframework.boot:spring-boot-starter-jdbc:3.2.0-M3'

    testImplementation '.junit.jupiter:junit-jupiter:5.9.3'
    testImplementation '.assertj:assertj-core:3.22.0'
    testImplementation '.mockito:mockito-core:5.4.0'
    testImplementation '.hamcrest:hamcrest:2.2'
    testImplementation '.springframework.boot:spring-boot-test:3.1.5'
    testImplementation '.springframework.boot:spring-boot-test-autoconfigure:3.1.5'
    testImplementation '.springframework:spring-test:6.0.13'

    runtimeOnly 'mysql:mysql-connector-java:8.0.30'
}

tasks.named('bootJar') {
    enabled = true // Ensure bootJar is enabled to create a runnable jar
}

bootRun {
     sourceResources sourceSets.main
}

(Some items removed for proprietary reason).

The command ./gradlew build works fine. But when we run ./gradlew -q :tasks --all we receive the following error:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\E40095342\RTN\code\satsim\aces-satellite-database-server\build.gradle' line: 101

* What went wrong:
Could not create task ':bootBuildImage'.
> Could not create task of type 'BootBuildImage'.
   > Could not generate a decorated class for type BootBuildImage.
      > /springframework/boot/buildpack/platform/io/TarArchive

* 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.
> Get more help at .

So far, all of my research points to trying to run a docker build using Gradle. But we are not doing anything with docker.

How do I get this task to not run? I've tried the following

gradle.taskGraph.whenReady { taskGraph -> 
    if (taskGraph.hasTask(bootBuildImage)) {
        task.enabled = false
    }
}

But the task still runs. What am I missing?

We are using gradle 8.8. This is a Spring Java application meant to run on a workstation. No android. No docker.

本文标签: javaGradle Disable BootBuildImage TaskStack Overflow