---
title: "maven tomcat eclipse debug"
author: "YOUNG918"
date: "2010-11-15T17:36:11Z"
tags: []
categories: ["企业架构"]
slug: "maven-tomcat-eclipse-debug"
draft: false
lastmod: "2010-11-15T17:36:11Z"
id: 812033
url: "https://leonandjava.iteye.com/blog/812033"
---

from:  [http://bandaidprogramming.blogspot.com/2008/03/maven-webapps-debug-with-eclipse-and.html](http://bandaidprogramming.blogspot.com/2008/03/maven-webapps-debug-with-eclipse-and.html "http://bandaidprogramming.blogspot.com/2008/03/maven-webapps-debug-with-eclipse-and.html")

 

I like using Maven. I also like using Step-Trace-Debugging. So here is what I do to accomplish this using Tomcat, Maven and Eclipse.

Required:

- Eclipse Sysdeo Tomcat Plugin [](http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-120.html)[http://www.eclipseplugincentral.com/Web\_Links-index-req-viewlink-cid-120.html]()
- Eclipse Maven Plugin

Steps:

- Create or Import your maven project into Eclipse
- Select File &gt; Properties for this project
- Select the Tomcat property
- Check the box "Is a Tomcat Project"
- Enter the context name. For my example, dcmdb
- Click Apply
- Go to /conf/Catalina/localhost and edit the context file i.e. dcmdb.xml.
  
  - Edit the docBase and workDir to point to the location of your maven project
  - Notice that the docbase **should point to ../dcmdb/target/dcmdb-1.0** where
    
    - **../dcmdb** = the location of my maven project
    - ../target/ = the directory that is created when using the maven package command
    - ../dcmdcb-1.0 = the directory that is my artifact name. It's the webapp
- The final step involves changing the Java Build Path property in Eclipse by pointing the source output to /target/dcmdb-1.0/WEB-INF/classes. This means that once you make a change to your code all you need to do is restart tomcat.