Anbuchelvan K
Anbuchelvan K

Reputation: 1

I have used gradle 6.3, spring boot 2.3.0.RELEASE I migrated to gradle 8.5 and spring boot 3.2.3 it's not working now

I am working on a spring-boot application. It was working when I was using gradle 6.3, spring boot 2.3.0.RELEASE and dependency-management as 1.0.15.RELEASE. Now I updated to gradle 8.5 spring boot 3.2.3 and dependency management as 1.1.5. I have java 21 in my system. ./gradlew clean builds successfully but clean build and bootRun fails.

ERROR: PS D:\login-using-spring-security\Login-verification-main> ./gradlew clean

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 565ms 1 actionable task: 1 up-to-date PS D:\login-using-spring-security\Login-verification-main> ./gradlew bootRun

Task :compileJava FAILED

FAILURE: Build failed with an exception.

Could not resolve all files for configuration ':compileClasspath'. Could not resolve org.springframework.boot:spring-boot-starter-data-mongodb. Required by: project : > No matching variant of org.springframework.boot:spring-boot-starter-data-mongodb:3.2.3 was found. The consumer was configured to find a library for use during compile-time, compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but: - Variant 'apiElements' capability org.springframework.boot:spring-boot-starter-data-mongodb:3.2.3 declares a library for use during compile-time, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'javadocElements' capability org.springframework.boot:spring-boot-starter-data-mongodb:3.2.3 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them preferably in the form of class files) - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-starter-data-mongodb-maven-optional:3.2.3 declares a library for use during compile-time, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-starter-data-mongodb-maven-optional:3.2.3 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-starter-data-mongodb:3.2.3 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-starter-data-mongodb:3.2.3 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them preferably in the form of class files) Could not resolve org.springframework.boot:spring-boot-starter-security. Required by: project : > No matching variant of org.springframework.boot:spring-boot-starter-security:3.2.3 was found. The consumer was configured to find a library for use during compile-time, compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but: - Variant 'apiElements' capability org.springframework.boot:spring-boot-starter-security:3.2.3 declares a library for use during compile-time, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'javadocElements' capability org.springframework.boot:spring-boot-starter-security:3.2.3 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them preferably in the form of class files) - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-starter-security-maven-optional:3.2.3 declares a library for use during compile-time, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-starter-security-maven-optional:3.2.3 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-starter-security:3.2.3 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-starter-security:3.2.3 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them preferably in the form of class files) Could not resolve org.springframework.boot:spring-boot-starter-thymeleaf. Required by: project : > No matching variant of org.springframework.boot:spring-boot-starter-thymeleaf:3.2.3 was found. The consumer was configured to find a library for use during compile-time, compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but: - Variant 'apiElements' capability org.springframework.boot:spring-boot-starter-thymeleaf:3.2.3 declares a library for use during compile-time, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'javadocElements' capability org.springframework.boot:spring-boot-starter-thymeleaf:3.2.3 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them preferably in the form of class files) - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-starter-thymeleaf-maven-optional:3.2.3 declares a library for use during compile-time, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-starter-thymeleaf-maven-optional:3.2.3 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-starter-thymeleaf:3.2.3 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-starter-thymeleaf:3.2.3 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them preferably in the form of class files) Could not resolve org.springframework.boot:spring-boot-starter-web. Required by: project : > No matching variant of org.springframework.boot:spring-boot-starter-web:3.2.3 was found. The consumer was configured to find a library for use during compile-time, compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but: - Variant 'apiElements' capability org.springframework.boot:spring-boot-starter-web:3.2.3 declares a library for use during compile-time, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'javadocElements' capability org.springframework.boot:spring-boot-starter-web:3.2.3 declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them preferably in the form of class files) - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-starter-web-maven-optional:3.2.3 declares a library for use during compile-time, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-starter-web-maven-optional:3.2.3 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-starter-web:3.2.3 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-starter-web:3.2.3 declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs) - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them preferably in the form of class files)

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 https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 925ms 1 actionable task: 1 executed

BUILD.GRADLE:

plugins {
    id 'org.springframework.boot' version '3.2.3'
    id 'io.spring.dependency-management' version '1.1.5'
    id 'java'
    id 'war'
}

group = 'com.djamware'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.4.1'
    providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    testImplementation 'org.springframework.security:spring-security-test'
}

test {
    useJUnitPlatform()
}

I tried reverting back to gradle 6.3, spring 2.3.0.RELEASE, Dependency management 1.0.15.RELEASE but it says version number 65 is not supported . It didn't work. Do I have to add gradle 8.5 in my path?

My gradle wrapper properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Upvotes: 0

Views: 172

Answers (1)

Suraj Mane
Suraj Mane

Reputation: 49

Below is the link to migrate spring boot 2 to 3 .

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide

Do you want to migrate java 8 to java 21 as well, if yes then change sourceCompatibility = '1.21'

Upvotes: 0

Related Questions