Reference http://appfuse.org/display/APF/AppFuse+QuickStart
Description of the above Tutorial:
SMTP Server
It is actually used to send emails. You can skip this step.
One function of Maven is to automatically download resources that do not exist (for example, if the spring package does not exist, MAVEN will automatically download the package and put it on the system disk by default ).
D:/Documents and Settings/your current user/. m2/Repository
Directory). For spring, it is placed in org/spring.
1. Install Maven 2.0.7:
: Http://maven.apache.org/download.html
Installation: http://maven.apache.org/download.html#Installation
Windows 2000/XP
- UnzipApache-maven-2.0.8-bin.zip
To the directory you wish to install Maven 2.0.8. These instructions assume you choseC:/program files/Apache Software Foundation/apache-maven-2.0.8
- AddBin
Directory to your path, by opening up the System Properties (winkey +
Pause), selecting the "advanced" tab, and the "environment variables"
Button, then editingPath
Variable in the user variables. Eg."C:/program files/Apache Software Foundation/apache-maven-2.0.8/bin"; % PATH %
- In the same dialog, make sure thatJava_home
Is set to the location of your JDK, eg.C:/program files/Java/jdk1.5.0 _ 02
- RunMVN -- version
To verify that it is correctly installed.
Use MVN-version to test whether the test is successful.
Maven version: 2.0.7
2. Build the struts2.0 + spring2.0 + hibernate Project
Enter the doscommand line:
E:/Maven (this is my directory, you can select it by yourself)
Enter the following command:
MVN archetype: Create-darchetypegroupid = org. appfuse. archetypes-darchetypeartifactid = appfuse-Basic-Struts-dremoterepositories = http://static.appfuse.org/releases
-Darchetypeversion = 2.0.1-dgroupid = com. mycompany. app-dartifactid = myproject
One of the preceding commands is described as follows:
This command is to use appfuse to build a struts2 base project (it has helped us to integrate the SSH framework and comes with a user management module, but we have not yet created a database, and we have to modify the database connection)
-Dgroupid: name of your company or organization-dartifactid: Project name
Enter the long wait .....
Maven has downloaded the package.
3. Modify the database connection:
Go to the generated project, open the Pom. xml file, and modify the following snippet. This is the configuration information of the MySQL database.
<! -- Database settings -->
...
<JDBC. url> <! [CDATA [JDBC: mysql: // localhost/struts2base? Createdatabaseifnotexist = true & amp; useunicode = true & amp; characterencoding = UTF-8]> </jdbc. url>
<JDBC. Username> root </jdbc. Username>
<JDBC. Password> </jdbc. Password>
...
4. Package A Project
Enter myproject (this is the value of-dartifactid = myproject)
Directory
E:/Maven/myproject>
Enter the command: MVN jetty: Run-war
If no exception occurs and the last line is displayed:
[Info] Starting interval at interval of 3 seconds.
Indicates that the operation is successful.
Open your browser and enter
Http: // localhost: 8080
Go to the logon page,
If the connection fails, check whether the database connection is configured incorrectly.
Everything is done.
For more information, see
Http://appfuse.org/display/APF
Wizard