- <P>
- 1. display the Tomcat console interface in the Windows command line window </P> <p> </P>
[HTML]View plaincopy
- <Property name = "tomcat. Home" value = "D: \ developer \ apache-Tomcat-6.0.32"/>
- <Target name = "stop_tomcat">
- <Echo> stop 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> start 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 is a file created in the previous target, used to output the Tomcat Start and Stop information.
Second, display the Tomcat console information in the eclipse Console
[HTML]View plaincopy
- <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>
Two Methods for starting and stopping tomcat in the ant script