2012-12-06 34 views

回答

3

如果你的項目是Scala或Java,你應該使用Scrooge。節儉-0.5.0-finagle被棄用。

0

您應該使用Scrooge。 Scrooge由Twitter開發。 Finagle也是由Twitter開發的。

提示:如下

<plugin> 
    <groupId>com.twitter</groupId> 
    <artifactId>scrooge-maven-plugin</artifactId> 
    <version>${scrooge.version}</version> 
    <configuration> 
     <thriftSourceRoot>${basedir}/src/main/thrift</thriftSourceRoot> 
     <includes> 
      <set>SyncWrite.thrift</set> 
     </includes> 
     <outputDirectory>${basedir}/src/main/gen/</outputDirectory> 
     <thriftNamespaceMappings> 
      <thriftNamespaceMapping> 
       <from>com.ganji.cdc.xapian.thrift.cpp</from> 
       <to>com.ganji.cdc.xapian.thrift.cpp</to> 
      </thriftNamespaceMapping> 
     </thriftNamespaceMappings> 
     <language>experimental-java</language> 
     <thriftOpts> 
      <thriftOpt>--finagle</thriftOpt> 
     </thriftOpts> 
     <buildExtractedThrift>false</buildExtractedThrift> 
    </configuration> 
    <executions> 
     <execution> 
      <id>thrift-sources</id> 
      <phase>generate-sources</phase> 
      <goals> 
       <goal>compile</goal> 
      </goals> 
     </execution> 
     <execution> 
      <id>thrift-test-sources</id> 
      <phase>generate-test-sources</phase> 
      <goals> 
       <goal>testCompile</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin> 

語言是experimental-java

的守財奴Maven插件應可配置。如果您配置爲Scrooge文檔,請使用javalibthrift庫必須使用0.5.0

有依賴庫如下

<finagle.version>6.25.0</finagle.version> 
<scrooge.version>3.18.1</scrooge.version> 

<!-- Finagle Start --> 
<dependency> 
    <groupId>org.apache.thrift</groupId> 
    <artifactId>libthrift</artifactId> 
    <version>0.9.0</version> 
</dependency> 
<dependency> 
    <groupId>com.twitter</groupId> 
    <artifactId>scrooge-core_2.10</artifactId> 
    <version>${scrooge.version}</version> 
</dependency> 
<dependency> 
    <groupId>com.twitter</groupId> 
    <artifactId>scrooge-runtime_2.10</artifactId> 
    <version>${scrooge.version}</version> 
</dependency> 
<dependency> 
    <groupId>com.twitter</groupId> 
    <artifactId>util-core_2.10</artifactId> 
    <version>6.24.0</version> 
</dependency> 
<dependency> 
    <groupId>com.twitter</groupId> 
    <artifactId>finagle-core_2.10</artifactId> 
    <version>${finagle.version}</version> 
</dependency> 
<dependency> 
    <groupId>com.twitter</groupId> 
    <artifactId>finagle-thrift_2.10</artifactId> 
    <version>${finagle.version}</version> 
</dependency> 
<!-- Finagle End --> 

這是所有。