0

Whenever i am trying to add dependency in the project through build.gradle , it is not able to add dependency. Instead it throws warning as

Could not resolve: junit:junit:4.12

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings

CONFIGURE SUCCESSFUL in 1s

I have tried every hook to resolve it, but was not able to. Please find below build.gradle file which i am using


apply plugin: 'java'
apply plugin: 'idea'

group 'practice'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
}
Abhi
  • 224
  • 2
  • 7
  • Check out this post: https://stackoverflow.com/questions/51610420/deprecated-gradle-features-were-used-in-this-build-making-it-incompatible-with and run your gradle build command with extra parameters. You'll get more info what got deprecated and you'll have a better idea how to resolve your deprecation issue. – c00ki3s Nov 16 '19 at 19:18

1 Answers1

1

As per mvnrepository.com, for Gradle it has been mentioned as

// https://mvnrepository.com/artifact/junit/junit testCompile group: 'junit', name: 'junit', version: '4.12'

The link is given below. https://mvnrepository.com/artifact/junit/junit/4.12

If it does not work, try to add the repository as given below.

repositories {
    maven { url 'http://repo1.maven.org/maven2' }
}

junit version 12 also available in maven repo, you can check following link.

http://repo1.maven.org/maven2/junit/junit/4.12/

Sometimes, we have seen sporadic issue because of corrupt file. You can delete the .gradle file and you can rerun with command like gradle clean build.

PythonLearner
  • 1,416
  • 7
  • 22