Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to mark gen as Generated Sources Root after SBT refresh? #311

Open
drhr opened this issue Jul 12, 2014 · 3 comments
Open

Comments

@drhr
Copy link

drhr commented Jul 12, 2014

Sorry if this is the wrong place to ask this, but I wondered if the sbt-idea plugin could somehow solve this problem I'm having.

I have an Android project that I'm importing into IntelliJ with the help of sbt-idea. It uses android-sdk-plugin and a build.sbt configuration file. The problem is that if you link IntelliJ's SBT up to the project (to automatically refresh the build when you make changes to your build.sbt configuration), it basically removes the "Generated Sources Root" designation from the gen directory, which as you might already know is an important source directory that the rest of your Android source code needs in order to identify resources like layouts, images, etc. So every time this SBT refresh happens, I have to right-click gen and Mark Directory As "Generated Source Root".

I tried adding this line to the end of build.sbt:

ideaSourcesClassifiers += "gen"

but I think I'm barking up the wrong tree with that one.

Does anyone have any thoughts?

@drhr
Copy link
Author

drhr commented Jul 21, 2014

Update on this: It's not too big of a deal. It really only happens when you update build.sbt or manually refresh the SBT project associated with your IDEA project. I actually started up another project recently as a desktop application and noticed something very similar - the various Source Roots would get redefined, which would break all the package names in imports in all my source files. Seems like more of an IDEA issue than SBT, but figured somebody has run into this already and perhaps solved it.

@jozic
Copy link
Contributor

jozic commented Jul 22, 2014

that sounds like IDEA issue, try to disable auto-import of changes in IDEA SBT settings

@tobiberger
Copy link

I still don't know how to mark a directory as generated sources root, but I got sbt to mark it as a source root in general, which is good enough for avoiding errors in your IDE. just add this to you build.sbt:
managedSourceDirectories in Compile += baseDirectory.value / "gen"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants