cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Cassandra Wiki] Update of "MavenPlugin" by StephenConnolly
Date Wed, 09 Feb 2011 11:36:29 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cassandra Wiki" for change notification.

The "MavenPlugin" page has been changed by StephenConnolly.
http://wiki.apache.org/cassandra/MavenPlugin?action=diff&rev1=2&rev2=3

--------------------------------------------------

  </project>
  }}}
  
+     While we are at it, add a reference to the jetty-maven-plugin and change the java source
level to 1.6
+ 
+     {{{
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+   <groupId>org.apache.wiki.cassandra.mavenplugin</groupId>
+   <artifactId>webapp</artifactId>
+   <packaging>war</packaging>
+   <version>1.0-SNAPSHOT</version>
+   <name>webapp Maven Webapp</name>
+   <url>http://maven.apache.org</url>
+   <dependencies>
+     <dependency>
+       <groupId>me.prettyprint</groupId>
+       <artifactId>hector-core</artifactId>
+       <version>0.7.0-25</version>
+     </dependency>
+     <dependency>
+       <groupId>junit</groupId>
+       <artifactId>junit</artifactId>
+       <version>3.8.1</version>
+       <scope>test</scope>
+     </dependency>
+   </dependencies>
+   <build>
+     <finalName>webapp</finalName>
+     <plugins>
+       <plugin>
+         <artifactId>maven-compiler-plugin</artifactId>
+         <version>2.3.2</version>
+         <configuration>
+           <source>1.6</source>
+           <target>1.6</target>
+         </configuration>
+       </plugin>
+       <plugin>
+         <groupId>org.mortbay.jetty</groupId>
+         <artifactId>maven-jetty-plugin</artifactId>
+         <version>6.1.24</version>
+       </plugin>
+     </plugins>
+   </build>
+ </project>
+ }}}
+ 
+  1. Now create a script to set-up our cassandra instance. First create the following directory
structure:
+     {{{
+ webapp
+  +-- pom.xml
+  \-- src
+       +-- cassandra
+       |    \-- cli
+       \-- main
+            +-- resources
+            \-- webapp
+                 +-- WEB-INF
+                 |    \-- web.xml
+                 \-- index.jsp
+ }}}
+ 
+     and then using your favourite editor, create a file called {{{load.script}}} in the
{{{webapp/src/cassandra/cli}}} directory.
+ 
+     {{{
+ create keyspace WebappKeyspace with replication_factor=1;
+ use WebappKeyspace;
+ create column family Example with column_type='Standard' and comparator='UTF8Type';
+ }}}
+ 
+  1. Now start development
+ 
+     {{{
+ $ mvn cassandra:start jetty:run -Dcassandra.jmxPort=7199
+ [INFO] Scanning for projects...
+ [INFO]                                                                         
+ [INFO] ------------------------------------------------------------------------
+ [INFO] Building webapp Maven Webapp 1.0-SNAPSHOT
+ [INFO] ------------------------------------------------------------------------
+ [INFO] 
+ [INFO] --- cassandra-maven-plugin:0.7.0-SNAPSHOT:start (default-cli) @ webapp ---
+ [INFO] Waiting for Cassandra to start...
+ ...
+ [INFO] [WARN] 11:32:02,516 Generated random token 11852913165738683554068538477956203649.
Random tokens will result in an unbalanced ring; see http://wiki.apache.org/cassandra/Operations
+ [INFO] Cassandra cluster "Test Cluster" started.
+ [INFO] Running /home/stephenc/src/cassandra-wiki/webapp/src/cassandra/cli/load.script...
+ ...
+ [INFO] Connected to: "Test Cluster" on 127.0.0.1/9160
+ [INFO] 3757b11f-3440-11e0-8318-e700f669bcfc
+ [INFO] Authenticated to keyspace: WebappKeyspace
+ [INFO] 37c0fa40-3440-11e0-8318-e700f669bcfc
+ [INFO] Finished /home/stephenc/src/cassandra-wiki/webapp/src/cassandra/cli/load.script.
+ [INFO] Cassandra started in 2.5s
+ [INFO] 
+ [INFO] >>> maven-jetty-plugin:6.1.24:run (default-cli) @ webapp >>>
+ ...
+ [INFO] Tmp directory =  determined at runtime
+ [INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
+ [INFO] Web overrides =  none
+ [INFO] web.xml file = /home/stephenc/src/cassandra-wiki/webapp/src/main/webapp/WEB-INF/web.xml
+ [INFO] Webapp directory = /home/stephenc/src/cassandra-wiki/webapp/src/main/webapp
+ [INFO] Starting jetty 6.1.24 ...
+ 2011-02-09 11:32:04.604:INFO::jetty-6.1.24
+ 2011-02-09 11:32:04.726:INFO::No Transaction manager found - if your webapp requires one,
please configure one.
+ 2011-02-09 11:32:04.916:INFO::Started SelectChannelConnector@0.0.0.0:8080
+ [INFO] Started Jetty Server
+ }}}
+ 
+     At this point you have a running web application at {{{http://localhost:8080/webapp/}}}
and a cassandra instance started on localhost. Jetty will automatically re-load the webapp
if you modify it, so you can now just start developing the web application (assuming you are
a masochist who likes writing web applications in ''jsp'' - gasp horror!)
+ 

Mime
View raw message