整合springboot + security + druid + swagger2 + jwt的 gradle 配置
// 配置阿里云的源
buildscript {
repositories {
maven {
url "http://maven.aliyun.com/nexus/content/groups/public"
}
}
// 構(gòu)建時候的一些依賴
dependencies {
}
}
// 編輯打包jar包時需要用到的依賴
plugins {
id 'org.springframework.boot' version '2.1.4.RELEASE'
id 'java'
// lombok使用打包時需加上這個 否則打包時候會報無法找到 getter 等一些方法
id("io.freefair.lombok") version "3.1.4"
}
// 引入
apply plugin: 'io.spring.dependency-management'
group = 'com.drink'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
compile.exclude module: 'spring-boot-starter-logging'//排除對默認(rèn)logging的依賴
}
}
repositories {
maven {
url "http://maven.aliyun.com/nexus/content/groups/public"
}
}
dependencies {
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.6'
// springboot 中使用mybatis時 不要再次添加org.mybatis 否則 會報找不到mapper方法的錯誤
compile group: 'org.mybatis.spring.boot', name: 'mybatis-spring-boot-starter', version: '2.0.1'
// springboot 的基本依賴
compile group: 'org.springframework.boot', name: 'spring-boot-starter', version: '2.1.4.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: '2.1.4.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-solr', version: '2.1.4.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.4.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-configuration-processor', version: '2.1.4.RELEASE'
// spring security 的使用
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-rest', version: '2.1.4.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '2.1.4.RELEASE'
// mysql
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.15'
// 生成接口文檔調(diào)試等
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
// jwt的使用
compile group: 'org.springframework.security', name: 'spring-security-jwt', version: '1.0.10.RELEASE'
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.1.4.RELEASE'
compile group: 'org.springframework', name: 'spring-jdbc', version: '5.1.6.RELEASE'
// druid 數(shù)據(jù)源的配置
compile group: 'com.alibaba', name: 'druid-spring-boot-starter', version: '1.1.10'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
// compile group: 'org.mybatis', name: 'mybatis', version: '3.4.1' 不要加上這行
compile group: 'com.github.pagehelper', name: 'pagehelper-spring-boot-starter', version: '1.2.10'
// 日志配置
compile group: 'log4j', name: 'log4j', version: '1.2.17'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-log4j2', version: '2.1.4.RELEASE'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
// new add
compile group: 'org.noggit', name: 'noggit', version: '0.5'
// Use JUnit test framework
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
// 配置resource
sourceSets {
main {
resources {
//可以將java目錄下的所有非.java資源打包到classes下
srcDir 'src/main/java'
}
}
}