« Return to Thread: Running a JRuby Script With Maven

Re: Running a JRuby Script With Maven

by Nick Sieger-2 :: Rate this Message:

Reply to Author | View in Thread

On Sun, Jul 12, 2009 at 9:23 PM, keithrbennett<keithrbennett@...> wrote:

>
> Leonardo -
>
> Thanks for providing that, but I don't know how I would modify
> it to suit my needs.  I've thought about it more, and here is a
> restatement of my needs that will hopefully be clearer:
>
> I'm looking to find or write a plugin that would drive JRuby
> scripts with a specified set of jar file dependencies.
>
> The scripts would merely be arguments to the Maven command, and
> don't even need to be in the project tree.  Here's what I'd like
> this plugin to do:
>
> * calculate transitive dependencies
>
> * download them if necessary
>
> * build a command line with the classpath, "java -jar
> ...jruby.jar", and any arguments passed to the Maven command
>
> * run that command

We have a jruby-rake-plugin that should be able to do this. You can
either look in JRuby's source repository for maven/jruby-rake-plugin
for inspiration to build your own or you can use as-is.

Try this in your pom.xml plugins section:

<plugin>
  <groupId>org.jruby.plugins</groupId>
  <artifactId>jruby-rake-plugin</artifactId>
  <version>1.3.1</version>
  <executions>
    <execution>
      <id>my-custom-script</id>
      <phase>generate-resources</phase>
      <goals><goal>rake</goal></goals>
      <configuration>
        <script>
          task :default do
            # load or write your script here
          end
        </script>
      </configuration>
    </execution>
  </executions>
  <dependencies>
    <!-- your dependent jars here -->
  </dependencies>
</plugin>

This should run JRuby with the provided dependencies available on the
classpath when the script launches.

/Nick

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Running a JRuby Script With Maven