AppFuse Maven Plugin 用来实现 AppFuse代码生成的工具
来源:互联网 发布:及时雨淘宝软件好用吗 编辑:程序博客网 时间:2024/06/11 21:08
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
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 should/should not generate stuff based on the packaging type (jar vs. 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 using the appfuse:gen command.
We hope to combine gen and gen-model into 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:
- 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
- Customize the templates in src/main/resources/appfuse.
- Run mvn install (use -Dmaven.test.skip=true if tests fail and you don't want to fix them).
- 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:
- Exports all sources from Subversion into your project. It reads the dao.framework and web.framework properties to determine what you need.
- Removes warpath plugin from pom.xml.
- 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.
- Reads properties from the root AppFuse pom.xml and adds the ones that don't exist to your project.
- Renames packages to match your project's groupId.
- AppFuse Maven Plugin 用来实现 AppFuse代码生成的工具
- 模板生成工具.模仿 appfuse 的 xdt 模板.
- AppFuse 2.1的安装运行步骤------利用Maven构建appfuse
- Appfuse中使用appgen自动生成代码InvocationTargetException的解决办法
- AppFuse
- appfuse
- appfuse
- AppFuse
- appfuse
- Appfuse
- appfuse
- appfuse
- appfuse
- Appfuse
- Appfuse
- 学习appfuse,用xdoclet代码生成
- read-AppFuse-19-自动生成代码描述
- 使用maven创建appfuse
- CSS+DIV入门
- 英语长句的分析
- 类与类关系的UML图与代码表现
- 一个诸葛亮,赛不上三个臭皮匠
- c新手和高手有兴趣来加这个群
- AppFuse Maven Plugin 用来实现 AppFuse代码生成的工具
- 英语长句分析经典100句
- JQuery SELECT单选模拟 - jQuery.select.js
- 建立ftp SERVER Using proftpd
- jsp连动菜单
- 入手一台XBOX360
- UNICODE汉字数据库
- vba 中, 创建文件夹, 获取行数, 新建excel文件
- 厚积薄发