Fail to start spring boot after upgrade to gradle 7.5.1

Hi ,

Appreciated for your help:

I encounter a problem, after upgrade gradle to 7.5. When I “Debug” run the application from IntelliJ IDE, I got the following:
10:37:59 main INFO c.w.h.i.ControlApplication Starting ControlApplication using Java 17.0.3 on WPC02FG109MD6Q with PID 11219 (/Users/jsow/rgt-ctrl/build/classes/groovy/main started by jsow in /Users/jsow/rgt-ctrl) 10:37:59 main INFO c.w.h.i.ControlApplication No active profile set, falling back to 1 default profile: “default” 10:38:01,615 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - debug attribute not set 10:38:01,616 |-INFO in ch.qos.logback.core.joran.action.StatusListenerAction - Added status listener of type [ch.qos.logback.core.status.OnConsoleStatusListener] 10:38:01,617 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 10:38:01,617 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE] 10:38:01,617 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.access.PatternLayoutEncoder] for [encoder] property 10:38:01,623 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [com.splunk.logging.HttpEventCollectorLogbackAppender] 10:38:01,626 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [splunk-cloud] 10:38:01,627 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.access.PatternLayout] for [layout] property 10:38:01,635 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to classpath:logback-access.xml 10:38:01,635 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [splunk-cloud] to classpath:logback-access.xml 10:38:01,635 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - End of configuration. 10:38:01,635 |-INFO in dev.akkinoc.spring.boot.logback.access.joran.LogbackAccessJoranConfigurator@1eb85a47 - Registering current configuration as safe fallback point

Task :ControlApplication.main() FAILED

Execution failed for task ‘:ControlApplication.main()’.

Process ‘command ‘/Users/jsow/Library/Java/JavaVirtualMachines/semeru-17.0.3/Contents/Home/bin/java’’ finished with non-zero exit value 1

  • 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.

this is spring boot application, using version 2.7.5

Here below: build.gradle

import java.time.ZoneId
import java.time.ZonedDateTime

apply plugin: ‘java’
apply plugin: ‘groovy’
apply plugin: ‘maven-publish’
apply plugin: ‘idea’
apply plugin: ‘eclipse’
apply plugin: ‘application’
apply plugin: ‘jacoco’
apply plugin: ‘docker’
apply plugin: ‘org.springframework.boot’
//apply plugin: ‘org.owasp.dependencycheck’

group = 'com.tom’
version = getBuildId() ?: gitBranch()

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

buildscript {
ext {
springBootVersion = ‘2.7.7’
}

repositories {
    maven {
        url "https://plugins.gradle.org/m2/"
    }
}

dependencies {
    classpath 'se.transmode.gradle:gradle-docker:1.2'
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    //     classpath 'org.owasp:dependency-check-gradle:7.3.2'
}

}

repositories {
maven {
url “JFrog
}
maven {
url ‘https://tom.pkgs.visualstudio.com/_packaging/ws-digital/maven/v1
credentials {
username “AZURE_ARTIFACTS”
password System.getenv(“AZURE_ARTIFACTS_ENV_ACCESS_TOKEN”) ?: “${azureArtifactsGradleAccessToken}”
}
}
mavenCentral()
maven {
name ‘groovy-wslite’
url ‘https://oss.sonatype.org/content/groups/public
}
}

dependencies {
//groovy
implementation libs.groovy.all
//azure
implementation libs.azure.storage
// spring boot
implementation(“org.springframework.boot:spring-boot-starter-web:${springBootVersion}”) {
exclude module: “spring-boot-starter-tomcat”
exclude module: ‘hibernate-validator’
}
implementation “org.springframework.boot:spring-boot-starter-aop:${springBootVersion}”
implementation “org.springframework.boot:spring-boot-starter-undertow:${springBootVersion}”
implementation ‘org.codehaus.groovy:groovy-all:2.4.6’
implementation ‘com.google.code.gson:gson:2.8.5’
implementation “org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}”

//
implementation 'com.github.ulisesbocchio:jasypt-spring-boot:3.0.1'
//
implementation 'com.tom:sabre-communicator:20211021.2'
// logback-access
implementation 'ch.qos.logback:logback-access:1.2.11'
implementation 'dev.akkinoc.spring.boot:logback-access-spring-boot-starter:3.4.3'

// swagger
implementation 'io.springfox:springfox-swagger2:2.6.1'
implementation 'io.springfox:springfox-swagger-ui:2.6.1'

// rules engine
implementation('com.cedarsoftware:n-cube:3.6.17') {
    exclude(module: 'log4j-core')
}

// excel spreadsheet support
implementation 'org.apache.poi:poi:3.8'
implementation 'org.apache.poi:poi-ooxml:3.8'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.2'

// Azure
implementation('com.splunk.logging:splunk-library-javalogging:1.6.2') {
    exclude(module: 'log4j-core')
}

testImplementation 'io.rest-assured:rest-assured:3.0.3'
testImplementation("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")
testImplementation 'io.rest-assured:spring-mock-mvc:3.0.3'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.25.0'
testImplementation 'io.cucumber:cucumber-junit:6.10.4'
testImplementation 'io.cucumber:cucumber-groovy:6.10.4'

}

/**

  • Copies the JVM System property into gradle
    */
    tasks.withType(JavaExec) {
    systemProperties System.properties
    }

/**

  • Find the git commit hash and branch
    */
    rootProject.ext.gitCommit = gitCommit()
    rootProject.ext.gitCommitShort = rootProject.gitCommit.toString().substring(0, 8)
    rootProject.ext.gitBranch = gitBranch()
    rootProject.ext.buildId = System.getenv(“BUILD_BUILDNUMBER”)
    rootProject.ext.buildDate = ZonedDateTime.now(ZoneId.of(“America/Edmonton”))

def gitCommit() {
def gitCommit = ‘’
def proc = “git rev-parse HEAD”.execute()
proc.in.eachLine { line → gitCommit = line }
proc.err.eachLine { line → println line }
proc.waitFor()
gitCommit
}

def gitBranch() {
if (System.getenv(“BUILD_SOURCEBRANCHNAME”)) {
return System.getenv(“BUILD_SOURCEBRANCHNAME”)
} else {
def gitBranch = “”
def proc = “git rev-parse --abbrev-ref HEAD”.execute()
proc.in.eachLine { line → gitBranch = line }
proc.err.eachLine { line → println line }
proc.waitFor()
gitBranch
}
}

def getBuildId() {
// build id will come from vsts
System.getenv(“BUILD_BUILDNUMBER”)
}
application {

// Define the main class for the application.
mainClassName = "com.tom.ControlApplication"

}
// (@see Spring Boot Gradle Plugin Reference Guide)
tasks.named(“jar”) {
enabled = false
}

processResources {
filesMatching(‘application.properties’) {
expand(project.properties)
}
}

springBoot {
buildInfo {
properties {
additional = [
‘number’: System.getenv(“BUILD_BUILDNUMBER”) ?: ‘unknown’,
‘id’: System.getenv(“BUILD_BUILDID”) ?: ‘unknown’
]
}
}
}

// boot jar name
bootJar {
archiveFileName = “holdcontrol.jar”
}

test {
useJUnitPlatform {
excludeTags (“functionalTest”)
}
finalizedBy jacocoTestReport // report is always generated after tests run
}

/**

  • Pretty prints build information
    */
    task printSummary {
    println ‘------------------------------------------------------------’
    println ‘Build summary’
    println ‘------------------------------------------------------------’
    println ‘Archive Name: ${jar.name}’
    println 'Version: ’ + rootProject.version
    println “Build ID: $buildId”
    println “Branch: $gitBranch”
    println “Commit: $gitCommit”
    println “Commit short: $gitCommitShort”
    println ‘------------------------------------------------------------’
    }

build.dependsOn printSummary

As you did not use code-tags (three backticks before and after your code) neither your given output, nor your build script is readable or copyable, please correct that.

But from a quick look at the error, I’d question whether that is a Gradle problem.
Gradle successfully starts your application which is also shown by log messages from your application being printed.
Then your application exists with code 1 and because of that the task fails.

Set a breakpoint right at the beginning of your application and step through it to find where it fails, or similar. Or raise your logging level to maybe get more information about what is going on. Again, I don’t think this is Gradle releated problem and thus also a bit misplaced in a Gradle forum. :slight_smile: