sbt-idea
sbt-idea copied to clipboard
Handle project.conf
When I create a project that has a "project.conf" under my resources folder, intellij doesn't recognise it. If I execute the project from within sbt (sbt run) it recognises the file and from then on it is also recognised within intellij. Is the file being copied somewhere when I do "sbt run'? Can gen-idea include the resources folder in the classpath so that the file gets picked up when I run the project within the IDE?
I think the correct way to handle this is to add *.conf
to the resource patterns list in the project's compiler settings.
sbt-idea doesn't touch this file, so we just put it under the source control. Though yes, I think it would be nice if sbt-idea generated this file too.
Totally agree with you. I argue this because it took me a while to understand how to properly add this to intellij. As gen-idea is configuring the whole intellij environment, I believe it should also consider this.
sbt-idea includes resources in classpath, but as @rtimush already mentioned IDEA will ignore file if doesn't match pattern in compiler settings. After your run sbt the file is copied in target/classes, so it's in classpath from now. If you clean target, then IDEA probably will stuck again. And if we add *.conf pattern, then next time it will stumble upon another config file with different extension.
Is your 'project.conf' a play app configuration file?
You're technically right that "if we add *.conf pattern, then next time it will stumble upon another config file with different extension."
Pragmatically, however, I think this is the right thing to do, as .conf
is the extension used by Typesafe config. It's trying to be the de facto config format for Scala, and is already used by Akka etc.
Ah I just noticed that it now generates a negative pattern (!?*.scala
etc) so reference.conf
was indeed being copied to the output. The actual problem was the ordering of the class path - I've opened another issue about that.