Skip to content

Instantly share code, notes, and snippets.

@akiellor
Last active December 20, 2015 08:49
Show Gist options
  • Save akiellor/6102781 to your computer and use it in GitHub Desktop.
Save akiellor/6102781 to your computer and use it in GitHub Desktop.
Maven + JRuby + Pry Example
package com.example.pry;
import org.jruby.embed.ScriptingContainer;
public class Main {
public static void main(String... args){
ScriptingContainer container = new ScriptingContainer();
container.runScriptlet("require 'pry'; binding.pry");
}
}
<project>
<!-- .... -->
<repositories>
<repository>
<id>gemjars</id>
<url>http://deux.gemjars.org</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>1.7.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.rubygems</groupId>
<artifactId>pry</artifactId>
<version>0.9.12.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
<!-- ... -->
</project>
<?xml version="1.0"?>
<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.example.pry</groupId>
<artifactId>pry</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>pry</name>
</project>
<project>
<!-- ... -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.example.pry.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- ... -->
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment