1.关于SpringBoot+Gradle排除依赖的问题
之前项目中是下边的引入核心依赖工程的
compile project(‘:core’)
但是不能直接加大括号,需要先将加小括号包裹project后再加大括号排除
compile (project(':core')){
exclude group: 'org.apache.poi', module: 'poi-ooxml'
}
如果没起作用可以试一下全局排除:
configurations.all {
exclude group: 'org.apache.poi', module: 'poi-ooxml'
}
2.我的项目代码
dependencies {
compile(
'org.springframework.boot:spring-boot-devtools',
'org.springframework.cloud:spring-cloud-starter-consul-discovery:1.3.1.RELEASE',
'org.springframework.cloud:spring-cloud-starter-feign:1.3.1.RELEASE',
'org.springframework.boot:spring-boot-starter-actuator:1.4.5.RELEASE',
'org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.0',
'org.springframework.boot:spring-boot-starter-data-mongodb',
'mysql:mysql-connector-java:5.1.38',
'net.sf.json-lib:json-lib:2.4:jdk15',
'tk.mybatis:mapper-spring-boot-starter:2.1.5',
'org.apache.poi:poi-ooxml:3.17'
)
if(env == "prod"){
compile(
'org.springframework.cloud:spring-cloud-starter-sleuth:1.2.1.RELEASE',
'org.springframework.cloud:spring-cloud-sleuth-zipkin-stream:1.2.1.RELEASE',
'org.springframework.cloud:spring-cloud-starter-stream-rabbit:1.2.1.RELEASE',
'org.springframework.cloud:spring-cloud-starter-hystrix:1.3.1.RELEASE',
'org.springframework.cloud:spring-cloud-netflix-hystrix-stream:1.3.1.RELEASE'
)
}
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '1.5.2.RELEASE'
testCompile group: 'junit', name: 'junit', version: '4.12'
// compile project(":core")
compile(project(':core')) {
exclude group: 'org.apache.poi', module: 'poi-ooxml'
}
}
希望对大家有帮助!欢迎交流学习!