AppFuse QuickStart

AppFuse QuickStart

To start developing Java applications with AppFuse 2, please following the instructions below:

Table of Contents

  1. Create a new project.
  2. Run it.
  3. Have Fun.

Create a project

  1. Setup your Development Environment - or follow the steps below if you're a veteran.
    1. Download and install JDK 5+ (make sure your JAVA_HOME environment variable points to the JDK, not a JRE).
    2. Download and install MySQL 5.x (or use a different database see here).
    3. Setup a local SMTP server or change mail.properties (in src/main/resources) to use a different host name - it defaults to "localhost".
    4. Download and install Maven 2.2.1+.
  2. From the command line, cd into your "Source" directory (c:\Source on Windows, ~/dev on Unix) run the Maven command you see below after choosing your web framework and other options.
Choose your Stack
AppFuse comes in a number of different flavors. To optimize and simplify your experience as a user, we've created a number of different archetypes (a.k.a. starter projects). There are currently three types of AppFuse Archetypes: light, basic and modular. Light archetypes are bare-bones, basic archetypes contain User Management and Security and modular archetypes contain "core" and "web" modules and are ideal for creating projects that have a re-usable backend. You should change the groupId to match your preferred package name and the artifactId to match your project's name.
The warnings you see when creating your project are expected. If you see BUILD SUCCESSFUL at the end, your project was created successfully.

You should be able to run AppFuse immediately if you have a MySQL 5.x database installed and it's accessible to root using no password. If you'd prefer to use an embedded database, we've recently added Database Profiles for H2, HSQLDB, etc.

Run your application

Running AppFuse is easy now. Once the archetype project is created, Maven will create and populate your database using the hibernate3 and dbunit plugins, respectively. All you have to do is use Maven to run the Jetty container and view your application.

  1. Decide if you want to change AppFuse from "embedded mode" to full-source mode by running mvn appfuse:full-source from your project's root directory. When you run appfuse:full-source after checkin you may run into problems.
    For AppFuse versions < 2.1.0
    The SVN repository location has changed. To avoid errors like ''svn: PROPFIND request failed on'' you'll need to add the following to the appfuse-maven-plugin's configuration section for everything to work. Add this to the created pom file in your project root.
  2. To view your application run mvn jetty:run from your project's directory (for a modular project, you'll need to run mvn jetty:run from your project's web directory (after installing the core module)). Maven will start Jetty and you should be able to view your application in your browser at http://localhost:8080.
  3. Check your new project into source control, unless you have a good reason not to. Google CodeGitHub, and BitBucket are good options.
  4. Run mvn from within your project to download JARs, Tomcat and run the integration tests in your project.
    The default username/password for an admin user is admin/admin. For a regular user, use user/user.

If you receive OutOfMemory errors when using mvn jetty:run, see this mailing list thread.

Changing database settings
To change your MySQL database settings, simply change the <jdbc.*> properties at the bottom of your pom.xml. See Database Profiles to use a database other than MySQL.
MySQL Security
Running MySQL using root with no password is not the most secure thing to do. Once your database is created, you can change the root password using the command below:
mysql --user=root --pass='' mysql -e "update user set password=password('newpw') \
where user='root'; flush privileges;"

AppFuse uses the username "root" and a blank password by default. To change these values, modify the <jdbc.username> and <jdbc.password> properties in your project's pom.xml (at the bottom).

Develop your application

You can develop your application using EclipseIDEA or NetBeans. For Eclipse, install m2eclipse and import your project. For IDEA, simply use File > Open Project and point to your project's directory. Further instructions can be found in the IDE Reference Guide.

The Tutorials should help you get started developing your application.

Developing Offline
If you'd like to develop your AppFuse application without an internet connection, you should download its dependencies and extract them to your ~/.m2/repository directory. The documentation from this wiki is also downloadable as a PDF.

你可能感兴趣的:(Appfuse)