This release contains several bug fixes as well as the ability to easily customize code generation templates.
If you're currently using AppFuse 2.0.1, there's a few things you'll need to change to upgrade to 2.0.2. If you're using a version prior to 2.0.1, you may want to follow previous upgrade instructions first.
|Diff is your friend|
The easiest way to make the changes below might be to compare your
The tutorial applications have been upgraded from 2.0.1 to 2.0.2. Looking at the diffs for these projects may be one of the easiest ways to upgrade.
- JSF Tutorial Upgrade Patch
- Spring MVC Tutorial Upgrade Patch
- Struts 2 Tutorial Upgrade Patch
- Tapestry Tutorial Upgrade Patch
|If you've used war:inplace|
If you've used mvn war:inplace in your project, make sure you remove your WEB-INF/classes and re-run war:inplace:
The following are a detailed set of steps you'll need to do if you're manually upgrading your project from a previous 2.x version.
- Backup your project on your local file system or (even better) in your source control system.
- In your
pom.xml, change <appfuse.version> to 2.0.2 and <spring.version> to 2.5.4.
- Maven's war overlay feature is based on timestamps. If you've overridden AppFuse files in your project, you'll need to "touch" them in order to give them a newer timestamp. Here's a sample of what you might run:
Alternatively, you could touch all files in src/main:
Another, more permanent, solution is to use
<dependentWarExcludes>to prevent the files from being overlayed.
- Upgrade the aspectj-maven-plugin to version 1.0 and add aspectjrt and aspectjtools as dependencies to the plugin.
- Upgrade the maven-eclipse-plugin to version 2.5.1.
- Upgrade the maven-jetty-plugin to version 6.1.9.
- Upgrade the hibernate3-maven-plugin to version 2.1.
- Replace your jMock dependency with the following two dependencies for jMock 2.4. See the jMock Getting Started Guide or Services Tutorial to see how to upgrade your tests to 2.4. You can also see changeset 3132 to see how AppFuse's tests were upgraded.
- In the <properties> section of your pom.xml, change jmock.version to 2.4.0 and webtest.version to R_1702.
- Upgrade to Spring Security 2.0.1.
- In log4j.xml, add the following to suppress Velocity logging messages:
- If you're using JSF, replace the <variable-resolver> in faces-config.xml with the following:
- If you're using Struts 2, add the following to your log4j.xml:
- In web-tests.xml, remove the file:// prefix from the entity imports:
The AppFuse Maven Plugin
This plugin currently does two things: 1) code generation for CRUD and 2) allows you to convert your project to use AppFuse's source instead of using its binary dependencies.
Generating CRUD with AMP
You can run the following command to generate CRUD screens/classes for a POJO:
If you don't specify the entity name, you will be prompted for it. Currently, if a @Column has "nullable = false", a "required field" validation rule will be generated as part of the web framework's validation configuration. This command will also install the generated code, unless you specify
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). If you want to generate specific code in a "war" project, you can use gen-core or gen-web.
You can run mvn appfuse:remove to remove the artifacts installed by appfuse:gen.
There's also a goal that allows you to generate model objects from database tables.
This goal will install the generated files into your source tree, unless you specify
-DdisableInstallation=true. After running this command, you can use appfuse:gen to generate CRUD classes/tests/screens for this object.
If you want to customize the code generation templates (written in FreeMarker), you can copy them into your project using the following command:
Installing AppFuse's source into your project
The good news is creating an "old style" project is now pretty easy. After you've create a new project using 2.x, you can run the following command:
This goal will convert your project to use all of AppFuse's source and remove all dependencies on AppFuse.
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. The order of the properties added is alphabetical.
- Renames packages from
org.appfuseto your project's groupId.
If you have issues developing AppFuse in Eclipse or NetBeans because of the WarPath plugin, running appfuse:full-source should fix that problem. It removes the warpath plugin as part of its installation process.