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

Case class and object conflict #47

Closed
ghost opened this issue Oct 26, 2015 · 3 comments
Closed

Case class and object conflict #47

ghost opened this issue Oct 26, 2015 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 26, 2015

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] {

@thesamet
Copy link
Contributor

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?

@ghost
Copy link
Author

ghost commented Oct 31, 2015

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.

@ghost
Copy link
Author

ghost commented Nov 1, 2015

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:
screen shot 2015-11-01 at 2 28 49 pm

After:
screen shot 2015-11-01 at 2 26 26 pm

@ghost ghost closed this as completed Nov 1, 2015
This issue was closed.
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

1 participant