After generating pb files, I cannot rebuild the project with this error
Error:(10, 18) LoginFailed is already defined as case class LoginFailed
final case class LoginFailed(
Error:(56, 8) LoginFailed is already defined as object LoginFailed
object LoginFailed extends com.trueaccord.scalapb.GeneratedMessageCompanion[LoginFailed] {
Can you do an sbt clean and try again? This may happen if you move classes around and you have old Scala files lying around.
If this still happens, can you post a sample project on github that can help reproduce this problem?
Here you go: https://github.com/lapminglee/scalapb_build_conflict.git
Repro steps:
1) I am using IntelliJ Idea 14.1
2) Open the sbt console (you need to install the IntelliJ plugin) and type "clean" and "compile"
3) Once it compiles, the generated files will sit in the "target" folder
4) Then click rebuild in the Build -> Rebuild Project
I think the conflict is because the generated files are by default generated into the target folder and IntelliJ is trying to read the file twice.
I found the problem. IntelliJ automatically marks two directories as "source root" so it tries to rebuild twice with the same files. Unmarking the "main" folder as a source root solves the problem.
Before:

After:

Most helpful comment
I found the problem. IntelliJ automatically marks two directories as "source root" so it tries to rebuild twice with the same files. Unmarking the "main" folder as a source root solves the problem.
Before:

After:
