Runtime Environment: eclipse3.5.2 Maven: 2.2.1
Step 1: Install Maven
Reference Official Website: http://maven.apache.org/download.html
Windows 2000/XP
- Unzip the distribution archive, I. e.Apache-maven-2.2.1-bin.zipTo the directory you wish to install Maven 2.2.1. These instructions assume you choseC:/program files/Apache Software Foundation. The subdirectoryApache-maven-2.2.1Will be created from the archive.
- AddM2_homeEnvironment variable by opening up the System Properties (winkey + pause), selecting the "advanced" tab, and the "environment variables" button, then addingM2_homeVariable in the user variables with the valueC:/program files/Apache Software Foundation/apache-maven-2.2.1. Be sure to omit any quotation marks around the path even if it contains spaces.Note: For Maven <2.0.9, also be sure thatM2_homeDoesn't have a'/'as last character.
- In the same dialog, addM2Environment variable in the user variables with the value% M2_home %/bin.
- Optional: In the same dialog, addMaven_optsEnvironment variable in the user variables to specify JVM properties, e.g. The value-Xms256m-xmx512m. This environment variable can be used to supply extra options to Maven.
- In the same dialog, update/createPathEnvironment variable in the user variables and prepend the value% M2 %To add Maven available in the command line.
- In the same dialog, make sure thatJava_homeExists in your user variables or in the system variables and it is set to the location of your JDK, e.g.C:/program files/Java/jdk1.5.0 _ 02And that% Java_home %/binIs in yourPathEnvironment variable.
- OpenNewCommand Prompt (winkey + r then typeCMD) And runMVN -- versionTo verify that it is correctly installed.
Step 2: InstallMavenEclipse plug-in
Reference Official Website: http://maven.apache.org/eclipse-plugin.html
Step 3: Create a Maven Project
3. Can be manually built: For details refer to the official website: http://maven.apache.org/guides/getting-started/index.html
MVN archetype: Create/
-DarchetypeGroupId=org.apache.maven.archetypes / -DgroupId=com.mycompany.app / -DartifactId=my-app
. Alternatively, right-click the eclipse menu and use the maven plug-in.
3.3 Add the Tomcat plug-in to the POM file:
<Plugin>
<Groupid> org. codehaus. Mojo </groupid>
<Artifactid> tomcat-Maven-plugin </artifactid>
<Version> 1.0 </version>
<Configuration>
<! -- <URL> http: // localhost: 8080/manager/html </URL> -->
</Configuration>
</Plugin>
Step 4: after the project is created, select external tools>External tools configurations...>
1. Create a program in the dialog box.
2. input the mavan path in the main panel such as: D:/apache-maven-2.2.1/bin/MVN. bat
3. Enter the project directory in the working directory.
4. Enter the running parameters in arguments, such as Tomcat: Run.
5. Create the parameter maven_opts in environment. The value is:
-Xdebug-xnoagent-djava. compiler = none-xrunjdwp: Transport = dt_socket, address = 4004, Server = Y, suspend = y
RememberIP address = 4004
6. Click Apply to save and run
Pic 1
Step 5:
Right-click the project menu to enable remote debugging: Debug as-> RUN deployments>
1.NewRemote Java application, contenction Properties> Project name HOST: Server Name (localhost) Port: Port (4004 corresponds to the address in step 4 ).
2. Click debug