然后打开eclipse,点”File->Import->General->Existing Projects into Workspace”,
最后打开D:\Tomcat7就能看到Tomcat7.0这个项目了。
(如果eclipse装了m2e插件不用执行mvn eclipse:eclipse的,可以直接导入maven工程)
5. 在Eclipse中让Tomcat跑起来
在Eclipse中打开org.apache.catalina.startup.Bootstrap类,
在编辑区右击,点”Run As->Run configurations”,然后双击”Java Aplication”就会出来一个新的”Bootstrap”,
选中它,在右边点击”Arguments”那一栏,把下面的内容copy到”VM arguments”中:
-Dcatalina.home=launch -Dcatalina.base=launch -Djava.endorsed.dirs=launch/endorsed -Djava.io.tmpdir=launch/temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=launch/conf/logging.properties
如下图:
498)this.width=498;'' onmousewheel = ''javascript:return big(this)'' class="alignnone size-full wp-image-1812" alt="" src="http://images.myeducs.cn/files/uploadimg/20120704/1025141.jpg" width="812" height="640" />
然后点run按钮,就可以启动tomcat了,启动成功会在Eclipse的console中显示:
- 2012-6-10 14:25:31 org.apache.catalina.startup.Catalina start
- 信息: Server startup in 359 ms
除上面这种方式外,这里还有一个Eclipse的launch脚本(start-tomcat7.launch (注: 在附件中)),
- <?xml version=“1.0″ encoding=“UTF-8″ standalone=“no”?>
- <launchConfiguration type=“org.eclipse.jdt.launching.localJavaApplication”>
- <listAttribute key=“org.eclipse.debug.core.MAPPED_RESOURCE_PATHS”>
- <listEntry value=“/Tomcat7.0/trunk/java/org/apache/catalina/startup/Bootstrap.java”/>
- </listAttribute>
- <listAttribute key=“org.eclipse.debug.core.MAPPED_RESOURCE_TYPES”>
- <listEntry value=“1″/>
- </listAttribute>
- <stringAttribute key=“org.eclipse.jdt.launching.MAIN_TYPE” value=“org.apache.catalina.startup.Bootstrap”/>
- <stringAttribute key=“org.eclipse.jdt.launching.PROGRAM_ARGUMENTS” value=“start”/>
- <stringAttribute key=“org.eclipse.jdt.launching.PROJECT_ATTR” value=“Tomcat7.0″/>
- <stringAttribute key=“org.eclipse.jdt.launching.VM_ARGUMENTS” value=“-Dcatalina.home=launch -Dcatalina.base=launch -Djava.endorsed.dirs=launch/endorsed -Djava.io.tmpdir=launch/temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=launch/conf/logging.properties”/>
- </launchConfiguration>
可