【问题标题】:Gradle -- Eclipse classpath still include the jar files that are excluded in the build.gradle fileGradle -- Eclipse 类路径仍然包含 build.gradle 文件中排除的 jar 文件
【发布时间】:2017-01-31 10:40:48
【问题描述】:

我正在尝试从 .classpath 文件中排除几个 jar,该文件由 gradle eclipse 插件生成。虽然我在 build.gradle 中执行以下操作来排除这些 jar,但类路径仍然包含这些 jar 文件。

configurations {
    eclipseExcludedDeps
}

dependencies {
    eclipseExcludedDeps group: "javax", name:"javaee-api", version: "${versions.javaee_api}"
    eclipseExcludedDeps group: "javax.xml.parsers", name:"jaxp-api", version: "${versions.jaxp_api}"
    eclipseExcludedDeps group: "xerces", name:"xmlParserAPIs", version: "${versions.xmlParserAPIs}"
}

eclipse {
    wtp {
        component {
            minusConfigurations << configurations.eclipseExcludedDeps
        }
    }
}

我已经尝试了 gradle 文档中提到的所有方法,但它们都不适合我。 我正在使用 gradle 2.7 版。要创建类路径,我运行“gradle eclipse”命令。 有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: gradle gradle-eclipse


    【解决方案1】:

    我自己不是 WTP 用户,但我认为您需要配置 eclipse.classpath

    eclipse {
       classpath {
           minusConfigurations += [ configurations.eclipseExcludedDeps ]
       }
    }
    

    【讨论】:

    • 感谢您的回复。我之前尝试过这种方法,但类路径仍然包含那些 jar。我怀疑它是否与我使用的 gradle 版本(2.7)有关。
    猜你喜欢
    • 2012-02-15
    • 2023-03-18
    • 1970-01-01
    • 2023-03-11
    • 1970-01-01
    • 2016-12-04
    • 1970-01-01
    • 1970-01-01
    • 2018-04-22
    相关资源
    最近更新 更多