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

broken sbt build due to sbt-protobuf dependency #74

Closed
forestofrain opened this issue Jan 8, 2016 · 4 comments
Closed

broken sbt build due to sbt-protobuf dependency #74

forestofrain opened this issue Jan 8, 2016 · 4 comments

Comments

@forestofrain
Copy link

I am unable to add this plugin addSbtPlugin("com.trueaccord.scalapb" % "sbt-scalapb" % "0.4.20") to my build due to issue in sbt-protobuf: see sbt/sbt-protobuf#37 for details.

error: reference to compile is ambiguous;
it is imported twice in the same scope by
import _root_.sbtprotobuf.ProtobufPlugin._
and import Keys._
  settings(mainClass in compile := Some("whatever")
@thesamet
Copy link
Contributor

thesamet commented Jan 8, 2016

When you use sbt-ascalapb, you don't need sbt-protobuf, you can generate both Scala and Java files with sbt-scalapb.

Would it be possible for you to avoid importing the plugin into the main scope.
See http://trueaccord.github.io/ScalaPB/sbt-settings.html

@forestofrain
Copy link
Author

Sorry for my confusion with the details. The issue details from sbt-protobuf were me including that plugin to show the author that the issue is with his plugin. When I include your plugin only, I still get a broken build because your plugin depends on sbt-protobuf. I wanted you to be aware that this dependency is causing an issue, not your plugin code.

You mention that I don't need sbt-protobuf, but I didn't see anything in the linked documentation that implies otherwise. Do you have details? Do you have an example of how to "avoid importing the plugin into the main scope"?

I am able to include your plugin if I use the workaround of aliasing compile using

import Keys.{compile => sbtCompile}

Once again, the real issue is with sbt-protobuf and me needing to use settings(mainClass in compile := Some("whatever")

@thesamet
Copy link
Contributor

thesamet commented Jan 8, 2016

If you'd like sbt-scalapb to generate Java classes enable javaConversions: import sbtprotobuf.{ProtobufPlugin=>PB}

The problem you are seeing with sbt-protobuf come from the fact that you are importing both sbtprotobuf.ProtobufPlugin._ and Keys._ and there is a name conflict on compile. This can happen between any pair of import, so I don't it's necessarily a bug. If you look at https://github.com/sbt/sbt-protobuf/blob/master/README.md the suggested import is:

import sbtprotobuf.{ProtobufPlugin=>PB}

@thesamet thesamet closed this as completed Jan 8, 2016
@thesamet
Copy link
Contributor

thesamet commented Jan 8, 2016

Also wanted to add that we are moving away from sbt-protobuf since it's unmaintained.

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

2 participants