Seeking Clarification: Dependencies

Hello,
I am looking to understand HOW gradle sees this, compared to me.

When I think dependencies I think of something the java file requires to compile/run correctly.

When i see dependencies in build.gradle they look like this:
dependencies {
compile ‘commons-collections:commons-collections:3.2.1’
}

My code requires the jar file containing the drivers for the database, in this case: com.microsoft.sqlserver.jdbc.SQLServerDriver so I tried this:

dependencies {
compile ‘commons-collections:commons-collections:3.2.1’
compile ‘com.microsoft.sqlserver.jdbc.SQLServerDriver’
}
What I got was this:
C:\Users\parisr\Documents\athenaeum>gradle run

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:\Users\parisr\Documents\NetBeansProjects\athenaeum\build.gradle’ line: 35

  • What went wrong:
    A problem occurred evaluating root project ‘athenaeum’.

Supplied String module notation ‘com.microsoft.sqlserver.jdbc.SQLServerDriver’ is invalid. Example notations: ‘org.gra
to-core:1.9.5:javadoc’.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.54 secs

So Line35 is where I put the com.microsoft.sqlserver.jdbc.SQLServerDriver in the build.gradle file.

Other Things to Know:

  1. the driver is in my classpath on the machine
  2. the code (.java) works when I use an IDE like NetBeans
  3. gradle -v

Gradle 2.3

Build time: 2015-02-16 05:09:33 UTC
Build number: none
Revision: 586be72bf6e3df1ee7676d1f2a3afd9157341274

Groovy: 2.3.9
Ant: Apache Ant™ version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_40 (Oracle Corporation 25.40-b25)
OS: Windows 7 6.1 x86

Gradle lets you specify dependencies on libraries. You don’t specify direct dependencies on classes that are contained within libraries. The “commons-collections” library has a bunch of classes, and you can reference the dependency for that library as you showed.

The SQLServerDriver class is also contained in a library, but unfortunately the library containing this class isn’t deployed to a public Maven repository (that I know of). The following SO posting describes this particular problem, and the bit of mess you have to go through to resolve it: http://stackoverflow.com/questions/6942407/setting-up-maven-dependency-for-sql-server. Considering how apparently new you are to all of this, I’m not hopeful you can easily get there.

Thanks for the information. I usually deal with mysql or Oracle but this time I have to deal with SQL Server. Looks like a good reference, though Thanks.