Maven debugging in eclipse

Source: Internet
Author: User

Runtime Environment: eclipse3.5.2 Maven: 2.2.1

Step 1: Install Maven


Reference Official Website:

Windows 2000/XP
  1. 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.
  2. 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.
  3. In the same dialog, addM2Environment variable in the user variables with the value% M2_home %/bin.
  4. 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.
  5. In the same dialog, update/createPathEnvironment variable in the user variables and prepend the value% M2 %To add Maven available in the command line.
  6. 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.
  7. OpenNewCommand Prompt (winkey + r then typeCMD) And runMVN -- versionTo verify that it is correctly installed.


Step 2: InstallMavenEclipse plug-in

Reference Official Website:


Step 3: Create a Maven Project

3. Can be manually built: For details refer to the official website:


MVN archetype: Create/

  -DarchetypeGroupId=org.apache.maven.archetypes / /  -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:



<Groupid> org. codehaus. Mojo </groupid>

<Artifactid> tomcat-Maven-plugin </artifactid>

<Version> 1.0 </version>


<! -- <URL> http: // localhost: 8080/manager/html </URL> -->






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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.