17.08.2016 Views

Apache Maven 3 Cookbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Extending <strong>Apache</strong> <strong>Maven</strong><br />

jruby-maven-plugin<br />

1.0-beta-4<br />

<br />

<br />

<br />

<br />

<br />

<br />

4. You need to build and install the plugin into your <strong>Maven</strong> local repository:<br />

$ mvn install<br />

5. After build success, the plugin is now available for execution from the command line<br />

or for further integration into other projects. To execute from the command line, try<br />

the following:<br />

$ mvn net.srirangan.packt.maven:maven-plugant-plugin:hello<br />

How it works...<br />

In the first step, we created the project structure based on the standard <strong>Apache</strong> <strong>Maven</strong> project<br />

skeleton. We followed it by creating a MOJO hello.rb. This MOJO class extends the Abstract<br />

Mojo and implements the execute method.<br />

We now have the source code ready for the JRuby plugin. However, to complete the<br />

project, we create the project POM file pom.xml. Here, we defined the dependency to the<br />

jruby-maven-plugin and included it in the element of the project<br />

object model.<br />

Finally, we installed our <strong>Maven</strong> JRuby plugin with the $mvn install command and saw an<br />

example on how to execute the plugin from the command line.<br />

202

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!