- <p>
- 第一,在windows 命令行窗口显示tomcat控制台界面</p><p> </p>
- <property name="tomcat.home" value="D:\developer\apache-tomcat-6.0.32" />
- <target name="stop_tomcat">
- <echo>停止tomcat</echo>
- <exec executable="cmd" dir="${tomcat.home}/bin" failonerror="false"
- output="${log.file}" append="true" >
- <!-- <arg value="/c" /> -->
- <env key="CATALINA_HOME" path="${tomcat.home}"/>
- <arg value="/c shutdown.bat" />
- </exec>
- </target>
- <target name="start_tomcat">
- <echo>启动tomcat</echo>
- <exec executable="cmd" dir="${tomcat.home}/bin" failonerror="false"
- output="${log.file}" append="true" >
- <!-- <arg value="/c" /> -->
- <env key="CATALINA_HOME" path="${tomcat.home}"/>
- <arg value="/c startup.bat" />
- </exec>
- </target>
log.file是在前面的target里面创建的文件,用来输出tomcat启动停止的信息。
第二,在eclipse控制台里面显示tomcat 控制台信息
- <target name="tomcat.start">
- <java jar="${tomcat.home}/bin/bootstrap.jar" fork="true" >
- <jvmarg value="-Dcatalina.home=${tomcat.home}" />
- </java>
- </target>
- <target name="tomcat.stop">
- <java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
- <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
- <arg line="stop"/>
- </java>
- </target>
- <target name="tomcat.debug">
- <java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
- <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
- <jvmarg value="-Xdebug"/>
- <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"/>
- </java>
- </target>