Maven Code Generator Tutorial

From JRapid

Jump to: navigation, search

JRapid's Maven Code Generator (local)

Contents

The local code generator can receive the following parameters

mvn jrapid:generate
  • -DcompileXsl: true|false (default=false)
  • -DcopyXsl: true|false (default=true)
  • -Dvalidate: true|false (default=true)
  • -DonlyValidate: true|false (default=false)
  • -DclientOnly: true|false (default=false)
  • -DserverOnly: true|false (default=false)
  • -Dtransformers: form|list|servicesabstract|etc (default=all)
  • -Dentity: comma separated entity names (default=all)


Explanation:

  • compileXsl: if true, compiles the XSLs into the translet files used in the generation
  • copyXsl: if true, copies from the maven's local repository into the jrapid-home (/YOUR-USER-HOME/jrapid/)
  • validate: if false, it skips the validations (both DTD and xsl validations)
  • onlyValidate: if true, it does not generate, it only runs the validations
  • clientOnly: if true, it generates using only client side transformers (form, panel, list, etc.)
  • serverOnly: if true, it generates using only server side transformers (servicesabstract, hibernate mappings, etc.)
  • transformers: comma separated list of transformers (identified by their canonican names)
  • entity: comma separated entity names, or parts of entity names ("pany" matches "Company")

More Targets

If you want to delete the generated code for already removed entities, you can do:

mvn jrapid:delete-entity -Dentity=entity1,entity2,etc


If you want to bring a jrapid-runtime (client side) from another project:

cd $PATH_TO_WEBAPP_ROOT
zip -r ./jrapid-runtime.jar jrapid-runtime -x "*/*.svn/*"
mvn install:install-file -DgroupId=com.jrapid -DartifactId=jrapid-runtime -Dversion=VERSION_NUM -Dpackaging=jar -Dfile=./jrapid-runtime.jar


JRapid AddOns

if you call:

mvn jrapid:addons 

you will get a list of possible add-ons, grouped by type of add-on (template, etc).

If you call:

mvn jrapid:addons -Dtype=template

you will get only the possible TEMPLATE add-ons.

And finally, when you choose a specific template, you call:

mvn jrapid:addons -Dtype=template -Did=74

and JRapid gets it for you.




JRapid Update

This target transforms a project from version 1.0 (no maven) to 1.1.

mvn jrapid:update

The steps to use it:

  • copy original project (not mavenized) folder to new folder (ie. /workspace/{$projectName}_1_1/)
  • copy a new pom.xml (of the jrapid version you want to use)
  • run mvn jrapid:update
Personal tools