julianpeeters / sbt-avrohugger

sbt plugin for generating Scala sources for Apache Avro schemas and protocols.
Apache License 2.0
133 stars 50 forks source link

Error when adding plugin settings for both 'generate' and 'generate-specific' #5

Closed qtreh closed 9 years ago

qtreh commented 9 years ago

I am not sure if it's a real issue, but importing plugin settings for both 'generate' and 'generate-specific' yields this error at compilation:

[error] .../hello/target/scala-2.11/src_managed/main/compiled_avro/com/avroserializer/MyClass.scala:4:MyClass is already defined as case class MyClass
[error] case class MyClass(var field1: Int, var field2: Int, var field3: Float) extends org.apache.avro.specific.SpecificRecordBase {

even though I only did avro:generate-specific and only one MyClass.scala class was generated. Problem solved when I imported only one setting in the SBT file, here I needed seq( sbtavrohugger.SbtAvrohugger.avroSettings : _*). It could be good to modify slightly the readme to tell people not to add both.

julianpeeters commented 9 years ago

Thanks for the feedback, I made a small change to the readme. I have been wondering if it's possible to split the settings up anyways, this is a good motivation to check. Not sure of the time frame though, since nothing is really broken this in on my back burner.

julianpeeters commented 9 years ago

I see that on closer inspection, there is no way to import both and still have the tasks automatically added to compile (without introducing a clunky step). So I hope the update to the readme is enough to prevent the same annoyance you suffered. Thanks again for reporting.