18VRaptor Scaffold
VRaptor scaffold extension to make it easier configuring new projects and plugins.
Installation
Ensure you have installed ruby and rubygems. You can easily find more information how to do this in the follow address http://www.ruby-lang.org/pt/downloads. After installed ruby stuffs open your terminal and run
gem install vraptor-scaffold
Getting started
Open your terminal again and run
vraptor new onlinestore
This command will create all configurations, after that go into onlinestore folder and run
ant jetty.run
open your browser in the follow address http://localhost:8080 and you should see It works!. Now lets create a CRUD to online store, to do that just run
vraptor scaffold product name:string value:double
and run server
ant jetty.run
Go http://localhost:8080/products
Package
The root default folder is app to change that you have the fallow command
vraptor new onlinestore --package=br.com.caelum
You can also change the model, controller and repository packages:
vraptor new onlinestore --package=br.com.caelum -m modelo -c controlador -r repositorio
Build: Maven, Gradle or Ivy
The default build tool is ant with ivy to deal with dependencies, to change your build tool, just create your application with:
# for maven
vraptor new onlinestore --build-tool=mvn
# for gradle
vraptor new onlinestore --build-tool=gradle
When using gradle, use
gradle jettyRun
to run the application.
ORM: JPA or Hibernate, connection pool
A new project already comes with the connection pool configured and in place. Besides that, one can choose between JPA (EntityManager, default), or Hibernate (Session), when creating your project:
vraptor new onlinestore -o=jpa
vraptor new onlinestore -o=hibernate
Freemarker
The default template engine is jsp, to change that create your application with
vraptor new onlinestore --template-engine=ftl
Eclipse
If you choose maven, run:
mvn eclipse:eclipse
to create eclipse files. If you are using ant eclipse files are generated with the application to skip them run
vraptor new onlinestore --skip-eclipse
Supported attributes type
The supported attributes type are: boolean, double, float, short, integer, long, string, text, date and references.
Plugins
Vraptor plugin can be installed by issuing a
vraptor plugin simple-email -v 1.0.0
You can find a list of available plugins at https://github.com/caelum/vraptor-contrib
jQuery
The jQuery version is always the latest available, you can choose older version with:
vraptor new onlinestore -j 1.4.4
Heroku
Now you can deploy any kind of Java application on Heroku with a simple
git push heroku master
And vraptor-scaffold take care with all the stuff you need to getting started with Heroku. To create an application that uses the heroku workflow just run:
vraptor new onlinestore --heroku
After that you need to follow the Heroku steps to get done. You can find more information here http://www.heroku.com/java
Help command
To get hold of all available commands execute
vraptor -h
To get more information on a command usage, use, for example:
vraptor new -h
vraptor scaffold -h
vraptor plugin -h
Contributing
This project is being developed in ruby and the source is hosted in https://github.com/caelum/vraptor-scaffold. Feel free to fork and create your path or features, dont forget the tests.