Ant publishes Web project, Tomcat Admin Interface publishes War project __web

Source: Internet
Author: User
Tags create directory mkdir java web

Today, the Java Web Project-ADJUSTSOLR is packaged as a war in the apache-ant-1.9.4 version and published to Tomcat (be sure to note that the JDK version you are developing is consistent with the JDK version in Tomcat, otherwise unsupport VERSION51 error)

Code to paste build.xml files

<?xml version= "1.0" encoding= "UTF-8"?> <project name = "ADJUSTSOLR" default = "war" Basedir = "." > <property name= "catalina.home" value= "d:/tomcat6.5-jdk1.7"/> <property name = "Build.dir" value = "Build" /> <property name = "Lib.dir" value = "Webcontent/web-inf/lib"/> <property name= "Webroot.dir"
   WebContent "/> <property name= classes.dir" value= "build/classes"/> <path id= "Project.classpath" > <fileset dir= "${lib.dir}" includes= ***.jar/> <!--add tomcat classpath--> <fileset dir= "${catalina. Home}/lib "> <include name=" *.jar "/> </fileset> </path> <pathconvert Pat   Hsep= "${line.separator}| 
	


|--"property=" Echo.path.compile "refid=" Project.classpath "> </pathconvert> <!--Create directory structure--> <target name= "init" depends= "clear" description= "Create initialization directory structure > <mkdir dir=" ${bui  
		Ld.dir} "/><mkdir dir= "${classes.dir}"/> </target> <!--javac Compile task--> <target name= "Compile" Init "description=" compiles Java file as Javac file "> <javac srcdir=" src "destdir=" ${classes.dir} "Includeantruntime=" Fals E "nowarn=" on "source=" 1.7 "target= 1.7" deprecation= "true" debug= "true" encoding= "UTF-8" cl asspathref= "Project.classpath" > <compilerarg line= "-xlint:unchecked"/> </javac> </target&gt

; <!--War Packaging task--> <target name= "war" depends= "compile" description= "packaged as Adjustsolr.war file" > <echo mess Age= "Begin war ..."/> <war destfile= ${build.dir}/${ant.project.name}.war "webxml=" Webcontent/web-inf/web.xml "> <fileset dir=" ${webroot.dir} "/> <lib dir=" ${lib.dir} "/> <classes" dir=} "${classes.dir/> T;/war> </target> <!--clean task--> <target name = "clear" > <delete dir = "Build"/> </ta Rget > </project > 
Put the war package under the build file under tomcat6.5-jdk1.7 or other Tomcat deployment:

Local Access connection: http://localhost:8082/adjustSolr/solrSearch.jsp

Published through the server Tomcat management interface:



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: info-contact@alibabacloud.com 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.