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.

Chapter 9<br />

How to do it...<br />

1. Create a folder called maven-plugjruby-plugin. This is your plugin project<br />

folder. In this, implement the standard <strong>Apache</strong> <strong>Maven</strong> directory structure and<br />

create src|main|scripts.<br />

2. Inside scripts, create the hello.rb MOJO:<br />

# @goal "hello"<br />

class Hello < Mojo<br />

end<br />

def execute<br />

info "hello world"<br />

end<br />

run_mojo Hello<br />

3. The next step is to create the project POM file (pom.xml) in the project root folder:<br />

<br />

4.0.0<br />

net.srirangan.packt.maven<br />

maven-plugjruby-plugin<br />

Example Ruby Mojo<br />

maven-plugin<br />

1.0-SNAPSHOT<br />

<br />

<br />

org.codehaus.mojo<br />

jruby-maven-plugin<br />

1.0-beta-4<br />

runtime<br />

<br />

<br />

<br />

<br />

<br />

maven-plugin-plugin<br />

2.4<br />

<br />

<br />

org.codehaus.mojo<br />

201

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

Saved successfully!

Ooh no, something went wrong!