[Java] 利用Gradle 取得SQL server driver

用Java 常用的repository 通常是Maven 或 Gradle. Microsoft 除了將部份project 開源外, 還有利用Maven 做它其中一個software repository. 然而, 利用Gradle 亦有方法在Mavel 中取得有關的library.

Build.gradle

repositories {
    mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("com.microsoft.sqlserver:mssql-jdbc")
}

利用mavenCentral() 可以將repository 指向Maven. 而sourceCompatibilitytargetCompatibility則設定取得版本的對應Java 的版本. dependencies 則設定要叫用的library. 語法如下:

[[group name]]:[[package name]]: [[optional: version no]]

 

About C.H. Ling 262 Articles
a .net / Java developer from Hong Kong and currently located in United Kingdom. Thanks for Google because it solve many technical problems so I build this blog as return. Besides coding and trying advance technology, hiking and traveling is other favorite to me, so I will write down something what I see and what I feel during it. Happy reading!!!

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.