« Return to Thread: Running a JRuby Script With Maven

Running a JRuby Script With Maven

by Keith R. Bennett :: Rate this Message:

Reply to Author | View in Thread

Hi all.  I'm using JRuby as a scripting language to call on Java libraries such as Apache Tika to do various kinds of work.  I'd like to use Maven to run these JRuby scripts because I'd like it to take care of finding jar file dependencies, and adding them to the classpath from the Maven repository.

I've found some info online, but it seems to be fancy stuff like how to build a JRuby plugin or how to set up a scripting interface in a Java 6 app.

I just want to run a JRuby script.  I know I'll need to set up the jar file dependencies in the pom.xml file, but that's trivial to do.

Can someone help me with this?  It would be very greatly appreciated.

Alternatively, is there some way I can use Maven's dependency management to generate a list of jar filespecs that I can use as a classpath in a command line script?  I know I can call "mvn dependency:resolve" and get output such as this that I could parse:

[INFO] [dependency:resolve]
[INFO]
[INFO] The following files have been resolved:
[INFO]    asm:asm:jar:2.2.3:runtime
[INFO]    asm:asm-commons:jar:2.2.3:runtime
[INFO]    asm:asm-tree:jar:2.2.3:runtime
[INFO]    backport-util-concurrent:backport-util-concurrent:jar:3.0:runtime
[INFO]    classworlds:classworlds:jar:1.1-alpha-2:compile
[INFO]    jline:jline:jar:0.9.91:runtime
[INFO]    junit:junit:jar:3.8.1:compile
[INFO]    org.apache.maven:maven-artifact:jar:2.0.4:compile
[INFO]    org.apache.maven:maven-artifact-manager:jar:2.0.4:compile

...but if there's an easier way that would be nice.

Thanks for any help,
- Keith Bennett

 « Return to Thread: Running a JRuby Script With Maven