maven-appfuse Configuration Steps
Configure the Environment:
Maven 2.2.1
Appfuse 2.0.2
JDK 1.6.0_10
MySQL 5.1
Download file:
1. Download to http://maven.apache.org/download.html Apache-maven-2.2.1-bin.zip
: Http://apache.freelamp.com/maven/binaries/apache-maven-2.2.1-bin.zip
2. To Https://appfuse.dev.java.net/servlets/ProjectDocumentList?
Folderid=9173&expandfolder=9173&folderid=0 Download Appfuse-dependencies-2.0.2.zip
Files: https://appfuse.dev.java.net/files/documents/1397/96443/appfuse-dependencies-
2.0.2.zip (each version of the jar package required in development)
3.JDK, MySQL self-download
MAVEN Installation and configuration:
1. Unzip the apache-maven-2.2.1-bin.zip to the location you want to install, such as E:\apache-maven-2.2.1.
2. Set the MAVEN system environment variable, maven_home=e:\apache-maven-2.2.1.
3. Add the MAVEN Bin directory to the System environment variable path,%maven_home%\bin.
4. Confirm the MAVEN installation and enter mvn-version at the command line
Hints that Apache Maven 2.2.1 is installed successfully;
If prompted error:java_home not found in your environment.
Please set the java_home variable in your environment to match the
Location of your Java installation
Configure the environment variable Java_home first, for example Java_home=f:\program files\java\jdk1.6.0_03
Appfuse Project Construction Steps:
1. Extract the downloaded appfuse-dependencies-2.0.2.zip to the%maven_home%\m2\repository.
2. On the command line, the CD enters your "source" directory (D:\source on Windows, ~/dev on Unix) Note: The project file will
Established under the current command path, for example, the Htframework project is built on D:\source\HTFramework.
3. You can go to Http://appfuse.org/display/APF/AppFuse+QuickStart+-+Chinese to select the kit you need to Struts2
MVN archetype:generate-b-darchetypegroupid=org.appfuse.archetypes -darchetypeartifactid=appfuse-
basic-struts -darchetypeversion=2.0.2 -dgroupid=com.hengte -dartifactid= Htframework
4. Run the MAVEN command in step 2nd, you should see a warning message when you build the project, and if you see the last build successful, the table
Your project has been established successfully.
5. Enter the D:\source\HTFramework project root directory, run mvn appfuse:full-source get appfuse source, if it appears
[INFO] Build successful indicates that Appfuse was established successfully.
6. If MySQL is already installed, modify the <jdbc.username> and <jdbc.password> properties (at the tail) of your project's pom.xml.
7. Generate a project that supports Eclipse, run MVN eclipse:eclipse under D:\source\HTFramework, and import the project to discover
Eclipse reported "Can't find M2_repo" error, in fact, this is an Eclipse environment variable, pointing to your local library. Add the variable to eclipse,
Method: Input M2_repo,path input e:/apache, Classpath Variables, Build Path, Preferences, Windows----- -maven-2.2.1/m2/repository can be.
8. How to install jars that are dependent on the local Data warehouse
Here's an example of how to upload a dwr.jar packet to a local data warehouse, as you can see from the example.
-download Dwr.jar package to the local, I put it in c:/
-Enter " Command line prompt, enter into c:/, and then execute MVN install:install-file-dfile=dwr.jar -
dgroupid=dwr.mocha -dartifactid=dwrdart -dversion=1.0 -dpackaging=jar The DWR to the local repository (my local warehouse address is: E:\apache-maven-2.2.1\m2\repository\), The jar package that is uploaded to the repository is named Dwrdart-1.0.jar,
Directory structure is Dwr/mocha/dwrdart/1.0/dwrdart-1.0.jar
9. Last step, start the service
-Go to "command line Prompt", enter D:\source\HTFramework, run MVN jetty:run
-Enter http://localhost:8080 in the browser to access the Appfuse project
Default User name: admin Password: admin
________________________________________________________________________
Here are some goal commands, here and Maven1 a lot of different, commonly used commands are:
Create a generic Java project for maven: MVN archetype:create-dgroupid=com.codeline.commons-dartifactid=pjoname
To create a MAVEN Web project:MVN Archetype:create-dgroupid=com.mycompany.app-dartifactid=my-webapp
-darchetypeartifactid=maven-archetype-webapp
Compiling the source code: mvn Compile (or: mvn compiler:compile)
To compile the test code:mvn test-compile
Run test:mvn Test
Generate site:MVN Site
Packaged:MVN Package
To install the jar in the local repository:mvn Install
To clear the resulting project:mvn Clean
To build the Eclipse project:mvn eclipse:eclipse
To generate the idea project:mvn Idea:idea
The combination uses the goal command, such as package-only not tested:Mvn-dtest Package
Compile the contents of the test:mvn test-compile
Just hit the jar package:mvn Jar:jar
Test without compiling and not compiling:mvn test-skipping compile-skipping test-compile(Pay special attention here-
Skipping flexible use, of course, can also be used for other combinations of commands)
Clear some system settings for Eclipse:mvn eclipse:clean
generate related code files according to Pojo : VN Appfuse:gen