Appfuse Maven plugin is a tool used to generate appfuse code.

Source: Internet
Author: User
About the appfuse Maven plugin (AMP)

This plugin currently does two things:

  • Code Generation for crud
  • Customizing amp templates
  • Converts your project to use appfuse's source

For more documentation on this plugin, see its Maven-generated site.

Generating crud with AMP

Stop and think before generating code!
At first, I didn't want to add a code-generation feature like this because you end up with a 1-to-1 Relationship between tables/pojos, daos and managers. on most of my projects, I have far fewer daos and managers than pojos.

Using this plugin, you can run the following command to generate crud Screens/classes for a pojo:

mvn appfuse:gen -Dentity=Name

If you don't specify the entity name, you're prompted for it. After generating the code, the plugin will install it for you as well, unless you specify-Ddisableinstallation = true. If you disable installation, you can install it using:

mvn appfuse:install -Dentity=Name

To remove the installed artifacts, use:

mvn appfuse:remove -Dentity=Name

If your entity is not defined in hibernate. cfg. XML, it will be added. in a modular project, these commands must be run in the "core" and "Web" modules. the plugin is smart enough to figure out when it shoshould/shoshould not generate stuff Based on the packaging type (jar. war ).

There's also a goal that allows you to generate model objects from database tables:

mvn appfuse:gen-model

Once you 've generated and installed the pojo, You Can generated crud for it usingAppfuse: GenCommand.

We hope to combineGenAndGen-ModelInto a single command.

Customizing amp templates

The freemarker templates that amp uses to generate code are packaged in the plugin itself. Since version 2.0.2, you can copy the code generation templates into your project using the following command:

appfuse:copy-templates

In previous versions, you can customize Templates using the following steps:

  1. Checkout the plugin from SVN (username:Guest, Password: <blank> ):

    svn co https://appfuse.dev.java.net/svn/appfuse/trunk/plugins/appfuse-maven-plugin appfuse-maven-plugin
  2. Customize the templates inSrc/main/resources/appfuse.
  3. RunMVN install(Use-dmaven. Test. Skip = true if tests fail and you don't want to fix them ).
  4. Make sure your project matches the version number you just installed.
Installing appfuse's source into your project

The good news is creating an "old style" project is now pretty easy. If you create a new project using 2.0-m5 +, you can now use:

mvn appfuse:full-source

This goal will convert your project to use all of appfuse's source and remove all dependencies on appfuse. It will also refactor all package names and directories to match your project's groupid.

What the full-source plugin does:

  1. Exports all sources from subversion into your project. It reads the Dao. Framework and web. Framework properties to determine what you need.
  2. Removes warpath plugin from Pom. xml.
  3. Calculates Dependencies by reading Pom. xml files form the various appfuse modules. It replaces your dependencies with these new ones. The order of the dependencies added is alphabetical Based on groupid.
  4. Reads properties from the root appfuse Pom. xml and adds the ones that don't exist to your project.
  5. Renames packages to match your project's groupid.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.