-1

Please help me to resolve this error...

Added Dependency in build.gradle

**// https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc4
testCompile group: 'com.microsoft.sqlserver', name: 'sqljdbc4', version: '4.0'**

After Refresh Gradle Project, getting the error below:

**Could not resolve: com.microsoft.sqlserver:sqljdbc4:4.0**
vgc
  • 21
  • 5

3 Answers3

1

"It worked for me after adding in locally, here are my Steps in Eclipse Neon."

Step 1.
create 'lib' folder under main project


Step 2.
copy the jar file 'sqljdbc4' to lib folder


Step 3.
Add below dependency in 'build.gradle' file
repositories {
    jcenter()
    mavenCentral()
    flatDir {
        dirs 'lib'
    }
}



dependencies {
 compile name: "sqljdbc4-4.0"
}



Step 4.
Right click on main Project and refresh gradle
vgc
  • 21
  • 5
  • Adding flat dir worked for me in 7.1.1 version of gradle too, without any IDEs tried from command prompt – rinilnath Jul 25 '21 at 17:18
0

I am not sure about your build.gradle file.

It should work.

testCompile group: 'com.microsoft.sqlserver', name: 'sqljdbc4', version: '4.0'`

is available in maven repository.

Did you gave

repositories {
        mavenCentral();
}

as the repository in your build.gradle file? If you gave this , then it should work.

If it is not working please share your full build.gradle file here, and the error trace so that we can get more idea about your question

Jince Martin
  • 211
  • 1
  • 3
  • 14
0

To resolve the dependency properly you need to add the maven url where the jar is located at.

Add this under repositories:

    maven { url "http://repo.spring.io/plugins-release/" }

Should look something like this (this declares multiple repositories):

    repositories {
        mavenCentral()
        maven { url "https://repo.spring.io/milestone" }
        maven { url "http://repo.spring.io/plugins-release/" }
    }
Mauricio
  • 180
  • 1
  • 2
  • 9