I got the same problem.... After I replace the dependencies for zkclient to 0.2 and it compiles.
在 15 Mar, 2013,8:21 AM,Dragos Manolescu <dragos.manole...@servicenow.com> 写道: > I dug into this and found a problem. The kafka build files show > dependencies on two different versions of the zkclient code: > > In core/build.sbt: > > libraryDependencies ++= Seq( > "org.apache.zookeeper" % "zookeeper" % "3.3.4", > "com.github.sgroschupf" % "zkclient" % "0.1", > "org.xerial.snappy" % "snappy-java" % "1.0.4.1", > "org.easymock" % "easymock" % "3.0" % "test", > "junit" % "junit" % "4.1" % "test" > ) > > And in project/Build.scala: > > // POM Tweaking for core: > def zkClientDep = > <dependency> > <groupId>zkclient</groupId> > <artifactId>zkclient</artifactId> > <version>20120522</version> > <scope>compile</scope> > </dependency> > > > In version 0.1 of com.github.sgroschupf.ZkClient (listed in build.sbt) > writeData doesn't return anything (http://j.mp/XBnn5g), which causes the > compile error from my initial message (see below); that changed in 0.2 > (http://j.mp/WqUx4x). > > zkclient-20120522 (listed in Build.scala) is checked in as a JAR in the > core/lib folder (http://j.mp/10U4XgE). > > I haven't researched why between sbt and IntelliJ ZkClient resolves > differently, and don't know the history behind the "POM tweaking" comment > above. I was able to build Kafka in IntelliJ by removing the reference to > com.github.sgroschupf.ZkClient. Perhaps this is a leftover from 0.7.2 (I > if I recall correctly it depends on 0.1)? > > At any rate if anybody runs into similar problems when building in InteliJ > I hope that this fix addresses them. Comments welcome. > > Thanks, > > -Dragos > > > > On 3/14/13 11:30 AM, "Dragos Manolescu" <dragos.manole...@servicenow.com> > wrote: > >> Hi Neha -- >> >> Thanks for the prompt answer. Yes that's what I did to open the project in >> IntelliJ. >> >> -Dragos >> >> On 3/14/13 11:22 AM, "Neha Narkhede" <neha.narkh...@gmail.com> wrote: >> >>> You can do ./sbt gen-idea to build the Intellij project .iml files. >>> >>> Thanks, >>> Neha >>> >>> >>> On Thu, Mar 14, 2013 at 11:20 AM, Dragos Manolescu < >>> dragos.manole...@servicenow.com> wrote: >>> >>>> Hi -- >>>> >>>> For the last couple of days I've been going through the 0.8 code as I'm >>>> porting some 0.7.2 producers and consumers to the 0.8 API. While sbt >>>> compiles the sources and indicates that 196 tests pass (I use Scala >>>> 2.9.2), >>>> I haven't been able to successfully build Kafka in IntelliJ (after >>>> generating the IDEA project with gen-idea). The errors are in ZkUtils; >>>> here's the first one, with subsequent errors caused by the absence of >>>> the >>>> returned value (of type org.apache.zookeeper.data.Stat). >>>> >>>> scala: type mismatch; >>>> found : Unit >>>> required: org.apache.zookeeper.data.Stat >>>> stat = client.writeData(path, data) >>>> ^ >>>> As far as I can tell writeData is provided by >>>> org.I0Itec.zkclient.ZkClient, and its return type is void rather than >>>> Stat; >>>> here's the signature: >>>> >>>> public void writeData(String path, Object object) { >>>> writeData(path, object, -1); >>>> } >>>> >>>> I thought that this might be dead code; however IntelliJ shows ZkUtils >>>> being used in the kafka, other and unit modules :-/ >>>> >>>> How do you marry IntelliJ with Kafka? >>>> >>>> Thanks, >>>> >>>> -Dragos >