0

I'm using the Typesafe Config library in a Kotlin project built with Gradle 6. How do I tell Gradle that there's a directory (or two, or specific files) with HOCON files that need to be added to the runtime classpath so Config can find them?

(SO is now suggesting that I edit the question to make it clear that the answer in Add resources, config files to your jar using gradle isn't relevant. It's not relevant because there's nothing about jar files in my question.)

5
  • You put the files under src/main/resources, like all the other classpath resources. docs.gradle.org/current/userguide/… Commented Dec 29, 2019 at 0:30
  • @JBNizet no, since it assumes there's a jar file being generated. That's not the case if you just run your code. Commented Dec 29, 2019 at 1:06
  • @JBNizet except that files in src/main/resources aren't added to the directories that are on the runtime classpath. By default, the only directory in the classpath that's in your project is build/classes/kotlin/main, and gradle doesn't copy files from src/main/resources to there. Commented Dec 29, 2019 at 1:09
  • I should think that this is your answer: stackoverflow.com/a/38982006/1005481 Commented Dec 29, 2019 at 6:46
  • Yes, resources end up in the runtime classpath whether you use Gradle to run your code or IntelliJ, and whether or not you create a jar. What makes you think they don't? What are you doing? What do you expect to happen? What happens instead? Commented Dec 29, 2019 at 6:53

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.