我正在使用Grails 2.0.3。在BuildConfig.groovy
中,我有以下排除情况。
dependencies {
runtime ('com.mycompany.apps.notification:client:1.2.1') {
excludes([ group: 'xom', name: 'xom' ])
}
}
我的依赖树如下所示。(使用maven2创建了树)
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree {execution: default-cli}]
[INFO] com.mycompany.apps.notification:notifytest:jar:0.0.1-SNAPSHOT
[INFO] \- com.mycompany.apps.notification:client:jar:1.2.1:compile
[INFO] \- com.mycompany.apps.notification:api:jar:1.2.1:compile
[INFO] \- com.mycompany.framework:platformservice.shared:jar:3.22.0:compile
[INFO] \- com.mycompany.framework:saml.res:jar:1.0.0:compile
[INFO] \- xom:xom:jar:1.1:compile
[INFO] +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] \- jaxen:jaxen:jar:1.1-beta-8:compile
[INFO] \- (xerces:xmlParserAPIs:jar:2.6.2:compile - omitted for duplicate)
[INFO] ------------------------------------------------------------------------
排除在树中的第4级之前都可以正常工作,但是在该级别以下不考虑排除。在我的示例中,排除在“com.mycompany.framework:platformservice.shared”之前有效,但在“com.mycompany.framework:saml.res”及以下版本中无效。
我使用maven 2.2进行了相同的尝试,并且排除在上述树的所有层中都起作用。我是否缺少在grails中进行某些配置以排除在更深层次上工作?还是已知问题?
最佳答案
我也遇到过类似的问题……驱使我疯狂。有几个jira问题可解决grails中的依赖项问题,希望它们将在2.3中得到解决。无论如何,要解决您的问题,我通常会排除更高的依赖项,然后直接包含它,然后排除我实际上试图从中排除的项目。烦人,但可以。
所以也许是这样的?
runtime ('com.mycompany.apps.notification:client:1.2.1') {
excludes([ group: 'com.mycompany.framework', name: 'saml' ])
}
runtime ('com.mycompany.framework:saml.res:1.0.0') {
excludes([ group: 'xom', name: 'xom' ])
}
有时,依赖项通常会变得很棘手,我会发现麻烦-刷新依赖项编译可以解决问题。或者,更糟的是删除整个.grails目录。
关于grails - Grails排除在更深层次上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10947333/