Could not find org.springframework.cloud:spring-cloud-starter-config:.
:my_app:main: Could not find org.springframework.cloud:spring-cloud-starter-config:. Required by: project :my_app
In my spring boot project I am trying to read properties from config-server.
My config server is running I am able to load and Now I am trying to the client side implementation.
Therefore I have added these three files in my build.gradle
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.cloud:spring-cloud-starter'
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
Now when I am trying to load I am getting issue.
Here is complete build.gradle file. Is this a right way to implement.
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.4'
id 'io.spring.dependency-management' version '1.1.3'
id 'eclipse'
id "com.diffplug.eclipse.apt" version "3.43.0"
id 'com.github.ben-manes.versions' version '0.48.0'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2'
implementation 'com.vladmihalcea:hibernate-types-60:2.21.1'
implementation 'com.onelogin:java-saml:2.9.0'
implementation 'org.springframework.data:spring-data-jpa:3.1.4'
implementation 'com.sendgrid:sendgrid-java:4.9.3'
implementation 'mysql:mysql-connector-java:8.0.33'
implementation 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
implementation 'org.hibernate.validator:hibernate-validator:8.0.1.Final'
implementation 'org.json:json:20230618'
implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation 'com.jayway.jsonpath:json-path:2.8.0'
implementation 'com.mchange:c3p0:0.9.5.4'
implementation 'net.dongliu:apk-parser:2.6.10'
implementation 'com.googlecode.plist:dd-plist:1.27'
implementation 'org.apache.commons:commons-lang3:3.13.0'
implementation 'org.apache.commons:commons-io:1.3.2'
implementation 'org.apache.httpcomponents:httpmime:4.5.2'
implementation 'org.apache.poi:poi:3.15'
implementation 'org.apache.poi:poi-ooxml:3.15'
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.560'
implementation 'com.amazonaws:aws-java-sdk-dynamodb:1.12.560'
implementation 'software.amazon.awssdk:dynamodb-enhanced:2.20.157'
implementation 'software.amazon.awssdk:dynamodb:2.20.157'
implementation 'com.google.guava:guava:32.1.2-jre'
implementation 'com.chargebee:chargebee-java:3.10.0'
implementation 'com.newrelic.agent.java:newrelic-api:8.6.0'
implementation 'com.newrelic.agent.java:newrelic-agent:8.6.0'
implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'com.newrelic.logging:log4j2:3.0.0'
implementation('org.springframework.boot:spring-boot-starter-web') {
exclude group: 'org.slf4j', module: 'slf4j-simple'
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.security:spring-security-oauth2-core:6.1.4'
implementation 'org.springframework.security:spring-security-oauth2-jose:6.1.4'
implementation 'org.springframework.security:spring-security-oauth2-client:6.1.4'
implementation 'org.springframework.session:spring-session-core'
implementation 'org.redisson:redisson-spring-boot-starter:3.23.5'
implementation 'org.springframework.boot:spring-boot-starter-jetty'
implementation 'org.eclipse.jetty.http2:http2-server:11.0.16'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.lmax:disruptor:3.4.0'
implementation 'com.twilio.sdk:twilio:9.2.2'
implementation 'org.flywaydb:flyway-core:9.22.2'
implementation 'org.flywaydb:flyway-mysql:9.22.2'
implementation 'com.messagebird:messagebird-api:6.1.1'
implementation 'org.jsoup:jsoup:1.16.1'
implementation 'commons-io:commons-io:2.14.0'
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-core:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.2'
implementation 'com.fasterxml.jackson:jackson-base:2.15.2'
implementation 'com.fasterxml.jackson:jackson-bom:2.15.2'
implementation 'commons-beanutils:commons-beanutils:1.9.3'
implementation 'com.newrelic.telemetry:micrometer-registry-new-relic:0.10.0'
implementation 'javax.media:jmf:2.1.1e'
implementation 'com.amplitude:java-sdk:1.12.0'
implementation 'org.mapstruct:mapstruct:1.5.5.Final'
compileOnly 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.5.Final'
implementation 'com.jashmore:java-dynamic-sqs-listener-spring-starter:6.0.0'
implementation 'org.springframework.cloud:spring-cloud-aws-messaging:1.0.0.RELEASE'
implementation 'com.amazonaws:aws-java-sdk-sts:1.12.560'
implementation 'software.amazon.payloadoffloading:payloadoffloading-common:2.1.3'
implementation 'net.jodah:failsafe:2.4.4'
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20220608.1'
implementation 'com.github.librepdf:openpdf:1.3.30'
implementation 'org.jfree:jfreechart:1.5.4'
implementation 'org.apache.xmlbeans:xmlbeans:5.1.1'
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20220608.1'
implementation 'org.springframework.boot:spring-boot-starter-freemarker:3.1.4'
implementation 'org.freemarker:freemarker:2.3.32'
implementation 'com.beust:jcommander:1.82'
implementation 'com.paypal.juno:juno-client:1.0.0'
implementation 'com.paypal.juno:juno-client-api:1.0.0'
implementation 'com.paypal.juno:juno-client-impl:1.0.0'
implementation group: 'jakarta.mail', name: 'jakarta.mail-api', version: '2.1.2'
implementation group: 'com.sun.mail', name: 'jakarta.mail', version: '2.0.1'
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.cloud:spring-cloud-starter'
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
}
group = 'com.example'
description = 'example'
java.sourceCompatibility = JavaVersion.VERSION_17
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
configurations.all {
exclude module: 'slf4j-log4j12'
exclude module: 'SLF4J'
exclude group: 'org.slf4j', module: 'slf4j-simple'
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-log4j2'
exclude group: 'org.slf4j', module: 'slf4j-simple'
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-websocket'
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}
eclipse {
jdt {
apt {
genSrcDir = file('build/generated/sources/annotationProcessor/java/main')
}
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-parameters"
}
To fix it you should declare version of org.springframework.cloud
that you are going to use.
To fix it just add next ones in your build.gradle
ext {
set('springCloudVersion', "2022.0.4") // 2022.0.4 is the latest one.
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
Or to your newest dependencies set also version :
implementation 'org.springframework.cloud:spring-cloud-starter-config:4.0.4'
implementation 'org.springframework.cloud:spring-cloud-starter:4.0.4'
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap:4.0.4'
Also 4.0.4
is the latest one.