Starting a Spring 3.0 Hibernate project with AppFuseFrom WikiJava
As an additional step I'll show you how to import this project in eclipse, and version it using GIT.
How it worksAppFuse can be very easily used as a Maven plugin. It offers several archetypes that generates many kinds of different template projects. The one we'll be using here is the: appfuse-basic-spring-archetype. Which generates a J2EE project, preconfigured with spring 3.0, hibernate, spring security, DWR (direct web remoting for simplifying ajax calls), ehcache and a lot more. You can get all this very simply using a single prompt command, using Maven. The Maven command to start up the project can be automatically created at app fuse website. What you'll get will look like this: mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes \ -DarchetypeArtifactId=appfuse-basic-spring-archetype \ -DarchetypeVersion=2.1.1-SNAPSHOT \ -DgroupId=org.wikijava \ -DartifactId=AppFuseExample \ -DarchetypeRepository=http://oss.sonatype.org/content/repositories/appfuse All you need to do is to change to the directory of your eclipse workspace and copy paste the command generated above. This will create a subdirectory called like whatever you wrote in the "artifactId" parameter above (in this example "AppFuseExample"). This new directory is a J2EE project ready to be deployed and with very basic functionalities, which you can extend in few steps. (I'll show you in the next article "expanding on the appfuse project" how to implement on this base) To be able to run this you need to have mysql server installed on your machine. Which is very easy and you can do following the instructions on Mysql website. Once you have mysql installed and running as a server, you can run your new application, to see that it all works. Change to the project directory and type: mvn jetty:run This will use Maven to install jetty app server on your project directory, deploy your project in the jetty, and start the jetty server on the port 8080. So you can now see your new application just browsing to http://localhost:8080/ If all goes well you will see in your browser the page below. (you can login as importing your AppFuse Project in EclipseEclipse is a great tool, and you definitely want to work on your project using this IDE. This can be done very easily again using Maven. It's just one prompt command away, and it is already well described in the article Using Maven and Eclipse, the basics. Using Appfuse and this procedure I had a little problem, so instead of the maven command in the article I used the following: mvn org.apache.maven.plugins:maven-eclipse-plugin:2.6:eclipse \
-DdownloadSources=true \
-DdownloadJavadocs=truewhich uses the (older) version 2.6 of the plugin which solves the problem. versioning everything with GITAt this point all is left to do is to add versioning to your project, so you can track changes and play around without risk. To do this follow the articke I've written Revisioning your project using GIT
Categories: Java EE | Java Advanced | Application Servers | Databases | Hibernate | Ajax | Spring | Maven |

