Database Profiles in AppFuse 2.0
Last night, I added several database profiles to AppFuse 2.0 and its archetypes. What does this mean? It means AppFuse should work out-of-the-box with several databases, including:
- H2
- HSQLDB
- MySQL
- PostgreSQL
- SQL Server
For example, here's how to test a new AppFuse project works with H2:
mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=1.0-m4-SNAPSHOT -DgroupId=com.mycompany -DartifactId=myproject
Yeah, I wish there was a way to shorten this command (or prompt for choices) too.
After doing this, you can cd into the "myproject" directory and run mvn integration-test -Ph2. AppFuse 2.0 projects are configured for MySQL by default, so if you want to permanently activate one of these profiles, you can add the following between the <id> and <properties> section of the profile.
<activation> <activeByDefault>true</activeByDefault> </activation>
In addition to the profiles listed above, I tried to get Oracle Express and embedded Derby working. No dice on either one. I took a brief look at DB2 Express as well, but with a 400 MB download and 3 JARs required for its JDBC Driver - it seemed like a lot more trouble than it was worth.
Maven 2's build profiles are a powerful feature that we hope to make easy to use. For example, to test your new project with H2 and JBoss, you can simply run mvn integration-test -Ph2,jboss. Thanks to the power of Cargo, this will download JBoss 4.0.5, install it, and run all the Canoo WebTests within it. Of course, this will take a while the first time - especially since JBoss is a 77MB download. Fortunately, we allow you to change one small setting in your pom.xml and use an existing install instead.
Maven 2 is a kick-ass build/deploy/test tool once you figure it out. With AppFuse 2.0, we're doing all the "figuring out" for you.
NOTE: I would add more server profiles, but Cargo's Maven Plugin (version 0.2) has issues with Geronimo 1.1, Jetty 6.x and Resin 3.x. Strangely enough, Jetty's Maven Plugin version 6.0.0 works great, but 6.1.0 throws stack traces.
Update: Support for Oracle and Derby (in networked mode) has been added. We'll consider adding support for DB2 if IBM can figure out how to package their JDBC Driver into a single JAR.
[1] https://www.twdata.org/projects/archy
Posted by Don Brown on February 15, 2007 at 01:14 AM MST #
Posted by anonymous on February 17, 2007 at 05:35 PM MST #
http://appfuse.org/display/APF/FAQ#FAQ-whereisthesource
Posted by Matt Raible on February 17, 2007 at 05:40 PM MST #
I also added AppFuse archetypes to the wiki page, but they still don't show up with Archy.
Posted by Matt Raible on February 19, 2007 at 05:20 AM MST #
Posted by Jeff Lambros on February 27, 2007 at 07:42 AM MST #
You're correct - this issue doesn't happen in the Ant version of AppFuse.
Posted by Matt Raible on February 27, 2007 at 07:58 AM MST #
I think that you might mean 'between the <id> and <properties> section of the profile' because I cannot find a <build> section in the profile?
eg. Is that correct?Posted by Luke McLean on April 11, 2007 at 10:21 AM MDT #
Posted by Matt Raible on April 17, 2007 at 04:40 AM MDT #
Posted by Luan on April 20, 2007 at 02:50 PM MDT #
Posted by Luan on April 20, 2007 at 04:49 PM MDT #
Posted by squiddle on May 06, 2007 at 02:43 PM MDT #
Posted by Stephen Connolly on May 27, 2007 at 06:35 PM MDT #
Posted by Sangeeta on June 06, 2007 at 09:41 AM MDT #
Posted by lasse on June 06, 2007 at 03:08 PM MDT #
that did the trick for me!
Posted by lasse on June 06, 2007 at 03:37 PM MDT #
Posted by Tobu on June 11, 2007 at 11:13 PM MDT #
Posted by Matt Raible on June 11, 2007 at 11:23 PM MDT #
Posted by Mustafa Sait Özen on June 22, 2007 at 11:07 AM MDT #
You could try that - or try to find a JDBC Driver for DB2 (maybe Derby's?) that is a single dependency. If you come up with a good solution (i.e. a dependency that references both of DB2's JARs), we'd be happy to host it in AppFuse's repo. Of course, you'll still need to install DB2's JARs locally, but we can handle the higher-level metadata.
Posted by Matt Raible on June 22, 2007 at 11:11 AM MDT #
Posted by Peder Jakobsen on July 08, 2007 at 06:53 PM MDT #
Posted by Mustafa Sait Özen on July 10, 2007 at 11:53 AM MDT #
Posted by Matt Raible on July 26, 2007 at 05:20 AM MDT #
Posted by Jayasanka on April 28, 2008 at 06:57 AM MDT #
I notice at the bottom of pom.xml, outside the <profiles/> element (within <properties/>) are a whole bunch of jdbc properties/values for MySql. Wouldn't those jdbc/MySql properties be better placed in their own <profile/> element, using an <activation/> to set them as the default, or am I missing something here? - I've been a die-hard Ant user and only just come to Maven!
Also, is there a way to instruct AppFuse to always use one of the other databases by default (I'd prefer one with a more liberal commercial licence).
Posted by Paul Pepper on September 09, 2008 at 01:26 PM MDT #
Posted by Matt Raible on September 09, 2008 at 03:45 PM MDT #
Posted by bini on February 24, 2009 at 05:28 PM MST #
Posted by Matt Raible on February 24, 2009 at 07:17 PM MST #