'Unable to run gradle program in command line

gradle test

Task :compileJava FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':compileJava'.

Could not resolve all dependencies for configuration ':detachedConfiguration1'. Could not resolve org.springframework.boot:spring-boot-dependencies:2.2.7.RELEASE. Required by: project : > Could not resolve org.springframework.boot:spring-boot-dependencies:2.2.7.RELEASE. > Could not get resource 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.2.7.RELEASE/spring-boot-dependencies-2.2.7. RELEASE.pom'. > Could not HEAD 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.2.7.RELEASE/spring-boot-dependencies-2.2.7.RELEA SE.pom'. > repo.maven.apache.org

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



Solution 1:[1]

    buildscript {
    repositories {
       
        maven {
            url "https://rb-artifactory.bosch.com/artifactory/gradle-plugins-remote/"
            credentials {
             username "***"
             password "***" 
            }
          }
            
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE")
        
    }
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "io.spring.dependency-management"
apply plugin: 'org.springframework.boot'
apply plugin: 'war'
apply plugin: 'jacoco'
apply plugin: 'application'


jacocoTestReport{
    reports{
        xml.enabled true
        csv.enabled true
        html.enabled true
        }
    
}

// This comes out to package + '.' + mainClassName
mainClassName = 'com.bosch.shop.ShopAuthentication'


repositories {
mavenCentral()
/*    maven {
        credentials {
                username "EED1COB"
             password "AP28P2xA2dB6pCNDcbrxx7uVuNo"
            }
        url "https://rb-artifactory.bosch.com/artifactory/gradle-mvn-remote/"
     }*/
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

configurations {
    providedRuntime
}

bootRun {
    // allows ./gradlew bootRun -Dspring.profiles.active=dev
    systemProperties System.properties
}

dependencies {

    implementation("org.springframework.boot:spring-boot-starter-web"){
    exclude group: 'org.apache.tomcat'
    } 
    implementation( "mysql:mysql-connector-java:5.1.28" )
    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
    implementation('org.springframework.boot:spring-boot-starter-data-mongodb')
    implementation("io.springfox:springfox-swagger2:2.6.1")
    //implementation group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'
    implementation("io.springfox:springfox-swagger-ui:2.6.1")
    //implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
    implementation("com.google.code.gson:gson:2.8.2")
    implementation("com.ocpsoft:ocpsoft-pretty-time:1.0.7")
    implementation('org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2')
    implementation ('org.json:json:20180130')
    implementation("com.jayway.jsonpath:json-path:2.0.0")
    implementation("com.mashape.unirest:unirest-java:1.4.9")
    implementation("io.jsonwebtoken:jjwt:0.5.1")
    implementation platform('org.springframework.boot:spring-boot-dependencies:2.0.5.RELEASE')
    implementation 'org.springframework.boot:spring-boot-starter-web'

    //implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.2'
    
    //overridden-
    //implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.8.0-beta2'
    implementation group: 'com.google.guava', name: 'guava', version: '27.1-jre'
    implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '9.0.37'
    implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-websocket', version: '9.0.37'
    implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-el', version: '9.0.37'
    
    implementation("com.sun.jersey:jersey-client:1.9.1")
    implementation group: 'com.zaxxer', name: 'HikariCP', version: '3.2.0'
    implementation group: 'org.locationtech.spatial4j', name: 'spatial4j', version: '0.7'
    testImplementation('org.springframework.boot:spring-boot-starter-test')
    providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
    testImplementation("junit:junit:4.12")
    testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.23.0'  
    implementation group: 'net.bytebuddy', name: 'byte-buddy', version: '1.9.7'
    implementation group: 'net.bytebuddy', name: 'byte-buddy-agent', version: '1.9.7'
       // https://mvnrepository.com/artifact/com.azure/azure-core
    implementation group: 'com.azure', name: 'azure-core', version: '1.22.0'
   // https://mvnrepository.com/artifact/com.azure/azure-messaging-servicebus
    implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.4.2' 
    implementation group: 'io.projectreactor', name: 'reactor-core', version: '3.4.12'
    implementation group: 'com.azure', name: 'azure-core-amqp', version: '2.3.4'
    implementation group: 'org.mongodb', name: 'mongo-java-driver', version: '3.12.10'
}

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        if (details.requested.group == 'org.apache.logging.log4j') {
            details.useVersion '2.15.0'
        }
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bhuvaneshwari M