Pull request Compare This branch is 526 commits behind torquebox:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


rails3 maven plugin

this plugin allows to manage a rails application from maven (i.e. also from a maven shell). you have a goal rails3:new which generates you an empty rails application with pom and then you can use rails3:rake, rails3:generate and rails3:server to manage common tasks with rails. finally there is an internal goal rail3:war which helps packing the rails application inside a war file.

note: the prefix rails3 is to distinguise another plugin for rails 2.3.x with rails as prefix

commandline/configuration arguments

in general you can use -Dargs=.... to pass in any arguments to any rails goal. but in case you want to execute more then one goal you have specialized argumets for each goal in the form -Dxyz.args=..... where xyz is the goal the arguments belong to. furthermore some goals have special arguments like the tasks with the rails:rake goal or app_path of rails3:new or generator of rails3:generate. see also the documentation of the respective goal for more details.

when configuring the plugin within the pom.xml you can use the same either a short argument name for all the goals or longer argument names for each goal different. the goal specific arguments have the form xyzArgs where xyz is the goal name.

the plugin needs maven3

this plugin uses gem-maven-plugin to manage gem artifacts which needs maven3: http://maven.apache.org/downloads.html


use outside of rails application

mvn rails3:new -Dapp_path=yet_another_blog

will generate a new application in yet_another_blog using the mysql database. with

mvn rails3:new

you get the usual help messages.

limitations: the edge and dev rails version might not work to be handled correctly, but when managed with bundler it should work.

use inside of rails application

an overview over the different possible commands

mvn rails3:new

and use the following for execute one of them

mvn rails3:new -Dargs=help


find out about the possible tasks with

mvn rails3:rake -Drails.args="-T"

or call a task like

mvn rails3:rake -Dtask=db:create -Drails.args="--trace"


run the development server with

mvn rails3:server

or with extra arguments

mvn rails3:run -Drails.args="-e production"


to get some overview of the installed generators execute

mvn rails3:generate

or call a specific generator, i.e. model

mvn rails3:generate -Dgenerator=model -Drails.args="UserAccount name:string"

rails3:console + rails3:dbconsole

two goals to run a console within the rails environment

note: not really working yet :-(