【问题标题】:Could not resolve all dependencies for configuration [custom configuration]无法解析配置的所有依赖项 [自定义配置]
【发布时间】:2019-12-11 15:42:00
【问题描述】:

拜托,我正在将 gradle 2.1 项目转换为 6.0,但出现此错误。

Could not resolve all dependencies for configuration ':driver'.
> Cannot convert the provided notation to a File or URI: classesDirs.
 The following types/formats are supported:
   - A String or CharSequence path, for example 'src/main/java' or '/usr/include'.
   - A String or CharSequence URI, for example 'file:/usr/include'.
   - A File instance.
   - A Path instance.
   - A Directory instance.
   - A RegularFile instance.
   - A URI or URL instance.

运行时

configurations.driver.each {File file ->
    loader.addURL(file.toURL())
}

驱动是自定义配置定义为

configurations {
    driver
}

dependencies {
    driver 'org.drizzle.jdbc:drizzle-jdbc:1.3'
}

请问有什么解决办法吗?

【问题讨论】:

  • 它适用于 Gradle 6.0。您是否尝试遍历“驱动程序”配置以外的任何其他内容?
  • 不,没有别的

标签: gradle gradle-plugin


【解决方案1】:

通过使用修复

sourceSets.main.output.resourcesDir = sourceSets.main.java.outputDir
sourceSets.test.output.resourcesDir = sourceSets.test.java.outputDir

而不是

sourceSets.main.output.resourcesDir = sourceSets.main.output.classesDirs
sourceSets.test.output.resourcesDir= sourceSets.test.output.classesDirs

【讨论】:

    猜你喜欢
    • 2016-02-14
    • 2014-11-17
    • 2016-10-31
    • 2017-03-17
    • 2018-02-11
    • 2020-12-20
    • 1970-01-01
    • 1970-01-01
    • 2017-05-14
    相关资源
    最近更新 更多