我有一个项目 (B),它编译本地 jar (A)。我需要排除 jar 内的依赖项 (A),但在构建 jar 时我无法做到这一点。我可以按照自己的意愿构建 jar,但我必须在其中包含这些依赖项,并且只将它们排除在项目 B 中。
这是项目A的build.gradle jar:
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'application'
repositories {
mavenCentral()
}
jar {
baseName = 'test'
version = '0.1.0'
manifest {
attributes ("Main-Class": "Main")
}
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:1.4.0.RELEASE") // I need this excluded later
compile("org.springframework.boot:spring-boot-starter-jetty:1.4.0.RELEASE") // I need this excluded later
/*
some other dependencies here
*/
}
这是项目 B 的 build.gradle:
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'application'
repositories {
mavenCentral()
flatDir(dirs: "lib")
}
sourceCompatibility = 1.8
dependencies {
compile ':test:0.1.0' // this is the jar I need to exclude some things from
compile("org.springframework.boot:spring-boot-starter-web:1.4.0.RELEASE")
compile("org.springframework.boot:spring-boot-starter-jetty:1.4.0.RELEASE")
}
似乎使用常规排除子句不起作用
compile (':test:0.1.0') {
exclude group: 'org.springframework.boot' // doesn't work
}
任何帮助将不胜感激。
最佳答案
关于java - 无法排除 jar 内的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39011017/