Today, the Java Web Project-ADJUSTSOLR is packaged as a war with the apache-ant-1.9.4 version and published to Tomcat (be aware that the JDK version of the development is consistent with the JDK version in Tomcat, otherwise unsupport VERSION51 error)
Code to paste the Build.xml file
<?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" value= " WebContent "/> <property name=" Classes.dir "value=" build/classes "/> <path id=" Project.classpath "> < Fileset dir= "${lib.dir}" includes= "***.jar"/> <!--Add Tomcat class path--<fileset dir= "${catalina.home}/ Lib "> <include name=" *.jar "/> </fileset> </path><pathconvert pathsep=" ${li ne.separator}| |--"property=" Echo.path.compile "refid=" Project.classpath "> </pathconvert> <!-- Create directory structure-<target name= "init" depends= "clear" description= "Create initialization directory Structure" > <mkdir dir= "${build.dir}"/ > <mkdir dir= "${classes.dir} "/> </target> <!--javac Compile task--><target name=" compile "depends=" init "description=" compile Java file for Java C File "> <javac srcdir=" src "destdir=" ${classes.dir} "Includeantruntime=" false "nowarn=" on "source= "1.7" target= "1.7" deprecation= "true" debug= "true" encoding= "UTF-8" classpathref= "Project.classpath" > <compilerarg line= "-xlint:unchecked"/> </javac> </target><!--War Pack task--><target name= "W Ar "depends=" compile "description=" packaged as Adjustsolr.war file > <echo message= "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}"/></war></target><!--Clean Task- -><target name = "clear" > <delete dir = "Build"/> </target > </project >
Place the war package under the build file under tomcat6.5-jdk1.7 or other Tomcat:
Local Access connection: http://localhost:8082/adjustSolr/solrSearch.jsp
Published through the server Tomcat management interface:
Ant publishing Web project, Tomcat Management Interface Publishing War project