Could not resolve all dependencies for configuration [custom configuration]

Hello,

Please, I’m working on converting a gradle 2.1 project to 6.0, but I get this error.

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.

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

driver is a custom configuration define as
configurations { driver }
dependencies { driver 'org.drizzle.jdbc:drizzle-jdbc:1.3' }

Please any ideas how to fix?

Hi @EnoIme,

The snippets you posted look like they should still work. Do you add something else to ‘driver’ which is not a normal dependency notation like ‘org.drizzle.jdbc:drizzle-jdbc:1.3’?
In particular, something called “classesDirs”? (Could be the output of a source set maybe.)

Yes. I have this

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

Because of this http://stackoverflow.com/questions/19653311/jpa-repository-works-in-idea-and-production-but-not-in-gradle

Fixed by using

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

Instead of

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

Thanks for the pointer @jendrik!

1 Like