Skip to content

Instantly share code, notes, and snippets.

@JJWTimmer
Last active December 16, 2015 00:10
Show Gist options
  • Save JJWTimmer/5345915 to your computer and use it in GitHub Desktop.
Save JJWTimmer/5345915 to your computer and use it in GitHub Desktop.
attempt 2 to get JRuby / cucumber running via Maven. Error returned: ```undefined method `Given' for main:Object```
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.rackspace.example</groupId>
<artifactId>ruby-stack-example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Examples: Ruby Stack</name>
<properties>
<cucumber-jvm-version>1.1.3</cucumber-jvm-version>
<GEM_HOME>${basedir}/src/test/gems</GEM_HOME>
<GEM_PATH>${basedir}/src/test/gems</GEM_PATH>
</properties>
<!-- Uncomment to use the snapshots, else install them by hand
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories> -->
<dependencies>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>1.7.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jruby</artifactId>
<version>${cucumber-jvm-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber-jvm-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>${basedir}/src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<!--<execution>
<phase>generate-test-resources</phase>
<configuration>
<target>
<echo message="Doing bundle install"/>
<java jar="${maven.dependency.org.jruby.jruby-complete.jar.path}"
fork="true" failonerror="true" maxmemory="512m"
newenvironment="true">
<env key="GEM_HOME" path="${basedir}/src/test/gems"/>
<arg value="-S"/>
<arg value="${basedir}/src/test/gems/bin/bundle"/>
<arg value="install"/>
<arg value="-gemfile=${basedir}/Gemfile"/>
</java>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>-->
<execution>
<phase>test</phase>
<id>run-cucumbers</id>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Running Cucumber Ruby Features"/>
<java fork="true"
classname="cucumber.api.cli.Main"
classpathref="maven.test.classpath"
failonerror="true">
<arg value="-f"/>
<arg value="pretty"/>
<arg value="--glue"/>
<!-- this path is relative to things in the class path -->
<arg value="src/test/resources"/>
<!-- this is the feature file to run, it doesn't accept globs -->
<arg value="src/test/resources"/>
</java>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>initial-bundle</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>generate-test-resources</phase>
<configuration>
<target>
<sequential>
<echo message="Installing gems"/>
<java jar="${maven.dependency.org.jruby.jruby-complete.jar.path}"
fork="true" failonerror="true" maxmemory="256m"
newenvironment="true">
<arg value="-S"/>
<arg value="gem"/>
<arg value="install"/>
<!--<arg value="bundler"/>-->
<arg value="capybara"/>
<arg value="rspec"/>
<arg value="selenium-webdriver"/>
<arg value="cucumber"/>
<arg value="chronic"/>
<arg value="rake"/>
<arg value="-i"/>
<arg value="${basedir}/src/test/gems"/>
<arg value="--no-ri"/>
<arg value="--no-rdoc"/>
</java>
<!--
<echo message="Initializing bundle"/>
<java jar="${maven.dependency.org.jruby.jruby-complete.jar.path}"
fork="true" failonerror="true" maxmemory="512m"
newenvironment="true">
<env key="GEM_HOME" path="${basedir}/src/test/gems"/>
<arg value="-S"/>
<arg value="${basedir}/src/test/gems/bin/bundle"/>
<arg value="init"/>
</java>
-->
</sequential>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment