项目里头有两个模块 一个是amdin一个是common 需求是 admin需要引用到common里头的文件,具体操作应该是将common最终打包成为一个jar包引入 具体配置文件如下
admin模块的 build.gradle
// 配置阿里云的源
buildscript {
repositories {
maven {
url "http://maven.aliyun.com/nexus/content/groups/public"
}
}
// 构建时候的一些依赖
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 = '1.0'
sourceCompatibility = '1.8'
apply plugin: 'java'
dependencies {
compile project(':drink-model')
compile project(':drink-common')
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.6'
annotationProcessor 'org.projectlombok:lombok'
// 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: '5.1.47'
// 生成接口文档调试等
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
// jwt的使用
// https://mvnrepository.com/artifact/org.springframework.security/spring-security-jwt
compile group: 'org.springframework.security', name: 'spring-security-jwt', version: '1.0.9.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 数据源的配置
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'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
// sms
compile group: 'com.github.qcloudsms', name: 'qcloudsms', version: '1.0.6'
// Use JUnit test framework
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
sourceSets {
main {
resources {
//可以将java目录下的所有非.java资源打包到classes下
srcDir 'src/main/java'
}
}
}
common的build.gradle
plugins {
id 'java'
// // lombok使用打包时需加上这个 否则打包时候会报无法找到 getter 等一些方法
id("io.freefair.lombok") version "3.1.4"
}
jar.enabled=true
group = 'com.drink'
version = '1.0'
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
其中 jar.enabled=true
这行代码起了作用
sourceSets {
main {
resources {
//可以将java目录下的所有非.java资源打包到classes下
srcDir 'src/main/java'
}
}
}
网友评论