gpt4 book ai didi

毕业 war : how to force inclusion of transitively provided dep?

转载 作者:行者123 更新时间:2023-12-03 04:47:55 27 4
gpt4 key购买 nike

有了这个build.gradle:

apply plugin: 'war'

repositories {
mavenCentral()
maven { url "http://repository.jboss.org/nexus/content/groups/public" }
}

configurations {
providedCompile {
exclude module: 'commons-httpclient' // here it doesn't work
}
}

dependencies {
compile 'commons-httpclient:commons-httpclient:3.1'

providedCompile ('org.jboss.resteasy:resteasy-jaxrs:2.3.3.Final') {
//exclude module: 'commons-httpclient' // here it works
}
}

我希望有这场 war :

WEB-INF/
WEB-INF/lib/
WEB-INF/lib/commons-httpclient-3.1.jar

但只有这个:

WEB-INF/

如果我取消注释第二个 exclude 并注释第一个 exclude,它会按需工作。

如果这是预期的行为,我如何才能从提供的库中全局排除特定的传递?

最佳答案

事实证明,这是发生的“正确”事情,因为 compile 实际上是从 providedCompile 扩展而来的:

apply plugin: 'war'

configurations.compile.extendsFrom.each {
println "$it"
}

所以,我的解决方案如下:

apply plugin: 'war'

repositories {
mavenCentral()
maven { url "http://repository.jboss.org/nexus/content/groups/public" }
}

configurations {
forceInclude {}
}

dependencies {
providedCompile 'org.jboss.resteasy:resteasy-jaxrs:2.3.3.Final'

forceInclude 'commons-httpclient:commons-httpclient:3.1'
}

war {
classpath += configurations.forceInclude
}

关于毕业 war : how to force inclusion of transitively provided dep?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12687672/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com