有没有办法从gradle依赖项中排除spring.xml?我已经为所有spring.xmls启用了自动扫描,但是不希望考虑来自特定jar的spring.xml。
compile('com.savnet.ofm:ofm-client:16.08') {
exclude group: "net.sf.saxon", module: "saxon-xpath"
exclude group: 'hibernate'
}
答案 0 :(得分:2)
您的意思是从您依赖的JAR中排除文件?
如果是这样,那么据我所知,没有本身支持的方式 但你可以手动制作 像下面的一样,现在完全弥补而未经过测试,所以把它作为一个可能起作用的起点,或者可能需要一些抛光才能起作用。
configurations { foo }
dependencies { foo 'com.savnet.ofm:ofm-client:16.08'}
sourceSets { main.compileClasspath += configurations.foo }
task fooJar(type: Jar) {
archiveName = 'foo.jar'
from zipTree(configurations.foo.singleFile)
exclude 'spring.xml'
}
然后使用fooJar
输出作为运行时库。
答案 1 :(得分:1)
有关动态调整jar的示例,请参阅here,具体取决于调整后的版本