Created
December 19, 2011 09:00
-
-
Save froop/1496181 to your computer and use it in GitHub Desktop.
[Java][Ant] Tomcatにデプロイする例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE configuration> | |
| <project basedir="." default="all" name="sample"> | |
| <property environment="env"/> | |
| <property name="catalina.home" value="${env.CATALINA_HOME}"/> | |
| <property name="manager.url" value="http://localhost:8080/manager/text"/> | |
| <property name="manager.user" value="manager"/> | |
| <property name="manager.pass" value=""/> | |
| <property name="src.web.dir" value="WebContent" /> | |
| <property name="dest.dir" value="dest"/> | |
| <property name="dest.java.dir" value="${dest.dir}/classes"/> | |
| <property name="war.file" value="${dest.dir}/${ant.project.name}.war"/> | |
| <import file="${catalina.home}/bin/catalina-tasks.xml"/> | |
| <target name="all" depends="clean,deploy" /> | |
| <target name="deploy" description="Deploy to Tomcat" depends="war"> | |
| <!-- | |
| <copy file="${war.file}" todir="${catalina.home}/webapps"/> | |
| --> | |
| <undeploy url="${manager.url}" | |
| username="${manager.user}" password="${manager.pass}" | |
| path="/${ant.project.name}" failonerror="no"/> | |
| <deploy url="${manager.url}" | |
| username="${manager.user}" password="${manager.pass}" | |
| path="/${ant.project.name}" war="${war.file}"/> | |
| </target> | |
| <target name="war"> | |
| <war destfile="${war.file}" webxml="${src.web.dir}/WEB-INF/web.xml"> | |
| <fileset dir="${src.web.dir}"> | |
| <include name="**/*" /> | |
| </fileset> | |
| <classes dir="${dest.java.dir}" /> | |
| </war> | |
| </target> | |
| <target name="clean" description="Delete files"> | |
| <delete file="${war.file}" /> | |
| </target> | |
| </project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment