sbt-idea icon indicating copy to clipboard operation
sbt-idea copied to clipboard

Handle project.conf

Open tiagoboldt opened this issue 12 years ago • 5 comments

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?

tiagoboldt avatar Dec 19 '12 14:12 tiagoboldt

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.

rtimush avatar Dec 19 '12 19:12 rtimush

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.

tiagoboldt avatar Dec 19 '12 22:12 tiagoboldt

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?

jozic avatar Dec 19 '12 23:12 jozic

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.

bchallenor avatar Jun 16 '13 11:06 bchallenor

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.

bchallenor avatar Jun 16 '13 13:06 bchallenor