Skip to content

Instantly share code, notes, and snippets.

@calo81
Created January 16, 2012 11:42
Show Gist options
  • Save calo81/1620488 to your computer and use it in GitHub Desktop.
Save calo81/1620488 to your computer and use it in GitHub Desktop.
MAVEN:CUCUMBER Maven profile for an application that runs cucumber test with JRuby. deploying a different WAR file, starting the Jetty server and running the cucumber against that one deployed application. Then stopping the server
<profile>
<id>cucumber</id>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.8</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>1.6.5-PATCH1</version>
<classifier>PATCH1</classifier>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc_license_cu</artifactId>
<version>${db2-version}</version>
</dependency>
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc</artifactId>
<version>${db2-version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>xxxxx</groupId>
<artifactId>yyyyyy</artifactId>
<version>${yyyyy.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jbossall-client</artifactId>
<version>4.2.2.GA</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.1.3</version>
<configuration>
<container>
<containerId>jetty6x</containerId>
<zipUrlInstaller>
<url>http://dist.codehaus.org/jetty/jetty-6.1.26/jetty-6.1.26.zip</url>
<downloadDir>${cucumber.work.directory}/downloads</downloadDir>
<extractDir>${cucumber.work.directory}/extracts</extractDir>
</zipUrlInstaller>
<dependencies>
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc_license_cu</artifactId>
</dependency>
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc</artifactId>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jbossall-client</artifactId>
</dependency>
</dependencies>
<systemProperties>
<db.host>${db.host}</db.host>
<db>${db}</db>
<db.user>${db.user}</db.user>
<db.password>${db.password}</db.password>
</systemProperties>
</container>
<configuration>
<type>standalone</type>
<home>${cucumber.work.directory}/web-app</home>
<properties>
<cargo.servlet.port>8090</cargo.servlet.port>
<db.host>10.194.192.228</db.host>
<cargo.jvmargs>-Ddb.host=10.194.192.228</cargo.jvmargs>
</properties>
<deployables>
<deployable>
<groupId>xxxxx</groupId>
<artifactId>yyyyy</artifactId>
<type>war</type>
<properties>
<context>/</context>
</properties>
</deployable>
</deployables>
</configuration></configuration>
<executions>
<execution>
<id>start-server</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-server</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<java classname="org.jruby.Main" fork="true">
<classpath refid="maven.compile.classpath" />
<arg line="-S gem install -i ${cucumber.work.directory}/gems jruby-openssl --no-ri --no-rdoc" />
</java>
<java classname="org.jruby.Main" fork="true">
<classpath refid="maven.compile.classpath" />
<arg line="-S gem install -i ${cucumber.work.directory}/gems diff-lcs --no-ri --no-rdoc" />
</java>
<java classname="org.jruby.Main" fork="true">
<classpath refid="maven.compile.classpath" />
<arg line="-S gem install -i ${cucumber.work.directory}/gems hoe --no-ri --no-rdoc" />
</java>
<java classname="org.jruby.Main" fork="true">
<classpath refid="maven.compile.classpath" />
<arg line="-S gem install -i ${cucumber.work.directory}/gems cucumber --no-ri" />
</java>
<java classname="org.jruby.Main" fork="true">
<classpath refid="maven.compile.classpath" />
<arg line="-S gem install -i ${cucumber.work.directory}/gems celerity --no-ri" />
</java>
<java classname="org.jruby.Main" fork="true">
<classpath refid="maven.compile.classpath" />
<arg line="-S gem install -i ${cucumber.work.directory}/gems rspec --no-ri" />
</java>
<java classname="org.jruby.Main" fork="true">
<classpath refid="maven.compile.classpath" />
<arg line="-S gem install -i ${cucumber.work.directory}/gems jruby-httpclient --no-ri" />
</java>
<echo>**** PATH: ${env.PATH} ****</echo>
<java classname="org.jruby.Main" fork="true">
<env key="JRUBY_OPTS" value="--1.9" />
<env key="GEM_PATH" value="${cucumber.work.directory}/gems" />
<env key="PATH" value="${cucumber.work.directory}/gems/bin:$PATH" />
<classpath refid="maven.compile.classpath" />
<classpath refid="maven.test.classpath" />
<arg line="--1.9 -S cucumber --require src/test/features/ --color --format pretty --format junit --out test-output/cucumber-reports/junit src/test/features" />
</java>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment