Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update demo and readme.md

  • Loading branch information...
commit c69c8e147265fc6f04ed7c553a093a1ec2ac2578 1 parent f172f97
@chunyan authored
View
8 README.md
@@ -58,7 +58,7 @@ SBT users need this:
val scrooge_runtime = "com.twitter.scrooge" % "scrooge-runtime" % "3.0.1"
-## Running Scrooge
+## Running Scrooge as a command line tool
To get command line help:
@@ -119,6 +119,12 @@ To use it, add a line like this to your `plugins.sbt` file:
(or whatever the current version is). Full details are in the sbt-scrooge
`README`.
+## Maven Plugin
+We ship a [scrooge-maven-plugin](https://github.com/twitter/scrooge/tree/master/scrooge-maven-plugin) with Scrooge,
+as well as an [example maven project](https://github.com/twitter/scrooge/tree/master/scrooge-maven-plugin/demo).
+Please refer to the [example pom file] (https://github.com/twitter/scrooge/tree/master/scrooge-maven-plugin/demo/pom.xml)
+
+
## Finagle integration
You can generate [finagle](https://github.com/twitter/finagle) binding code
View
62 maven-scrooge-plugin/README.md
@@ -1,62 +0,0 @@
-# maven-scrooge-plugin
-
-## Using the plugin
-Here is an example of how to add maven-scrooge-plugin into your maven project.
-
- <dependencies>
- ...
- <!-- dependencies where we want to extract thrift files from -->
- <dependency>
- <groupId>com.twitter</groupId>
- <artifactId>foo-thrift-only</artifactId>
- <version>4.3.0</version>
- <classifier>idl</classifier>
- </dependency>
- <dependency>
- <groupId>com.twitter</groupId>
- <artifactId>bar-thrift-only</artifactId>
- <version>7.8.0</version>
- <!-- not an idl classifer, need to be added to whitelist below -->
- </dependency>
- </dependencies>
- <plugins>
- ...
- <plugin>
- <groupId>com.twitter</groupId>
- <artifactId>maven-scrooge-plugin</artifactId>
- <version>3.0.6-SNAPSHOT</version>
- <configuration>
- <thriftNamespaceMappings>
- <thriftNamespaceMapping>
- <from>com.twitter.old</from>
- <to>com.twitter.new</to>
- </thriftNamespaceMapping>
- </thriftNamespaceMappings>
- <thriftOpts>
- <!-- add other Scrooge command line options using thriftOpts -->
- <thriftOpt>--finagle</thriftOpt>
- <thriftOpt>--ostrich</thriftOpt>
- <thriftOpt>-v</thriftOpt>
- </thriftOpts>
- <dependencyConfig> <!-- this is the whitelist -->
- <include>bar-thrift-only</include>
- </dependencyConfig>
- </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>
- </plugins>
View
59 maven-scrooge-plugin/demo/pom.xml
@@ -10,13 +10,35 @@
<git.dir>${project.basedir}/../../../.git</git.dir>
</properties>
<dependencies>
- <!-- scala library -->
+ <!-- how to add thrift dependencies -->
+ <!-- if the artifact has "idl" classifer, you can specify it
+ <dependency>
+ <groupId>com.twitter</groupId>
+ <artifactId>foo</artifactId>
+ <version>0.1.0</version>
+ <scope>compile</scope>
+ <classifier>idl</classifier>
+ </dependency>
+ -->
+
+ <!-- if the artifact does not have "idl" classifier, then you need to
+ - add it as a dependency here.
+ - add the artifactId as <dependencyConfig> in scrooge-maven-plugin, as seen later
+ <dependency>
+ <groupId>com.twitter</groupId>
+ <artifactId>bar</artifactId>
+ <version>1.0.1</version>
+ <scope>compile</scope>
+ <classifier>idl</classifier>
+ </dependency>
+ -->
+
+ <!-- common library dependencies -->
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.9.2</version>
</dependency>
- <!-- library dependencies -->
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
@@ -71,15 +93,6 @@
<version>2.4.0</version>
<scope>test</scope>
</dependency>
- <!-- Add thrift dependencies in the following format
- <dependency>
- <groupId>com.twitter</groupId>
- <artifactId>gizmoduck-thrift-only</artifactId>
- <version>4.3.0</version>
- <scope>compile</scope>
- <classifier>idl</classifier>
- </dependency>
- -->
</dependencies>
<build>
<plugins>
@@ -90,7 +103,10 @@
<configuration>
<source>1.6</source>
<target>1.6</target>
- </configuration>
+ <fork>true</fork>
+ <meminitial>128m</meminitial>
+ <maxmem>512m</maxmem>
+ </configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
@@ -102,6 +118,20 @@
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
+ <configuration>
+ <args>
+ <param>-unchecked</param>
+ <param>-deprecation</param>
+ <param>-encoding</param>
+ <param>utf8</param>
+ </args>
+ <!-- Scrooge generates more files (one file per struct), so
+ you might need to increase running memory for maven
+ -->
+ <jvmArgs>
+ <jvmArg>-Xmx2G</jvmArg>
+ </jvmArgs>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -136,6 +166,11 @@
<thriftOpt>--ostrich</thriftOpt>
<thriftOpt>-v</thriftOpt>
</thriftOpts>
+ <!-- tell scrooge to extract thrifts from these artifacts as well
+ <dependencyConfig>
+ <include>bar</include>
+ </dependencyConfig>
+ -->
</configuration>
<executions>
<execution>
Please sign in to comment.
Something went wrong with that request. Please try again.