awips2/edexOsgi/build.edex/deploy-common/deploy-web.xml
2022-05-05 12:34:50 -05:00

62 lines
No EOL
2.4 KiB
XML

<!--
Ideally, we will be able to transition the web projects to Eclipse WPT
projects and then will will no longer need to manually package and
deploy a war file.
-->
<project>
<!-- =================================================================== -->
<!-- Generic macro to build and deploy any web application. -->
<!-- =================================================================== -->
<macrodef name="deploy.war">
<attribute name="web.project.dir" />
<attribute name="war.name" />
<attribute name="webapps.dir" />
<sequential>
<!-- find the web "project" -->
<var name="project.dir" value="" />
<for list="${basedirectories}" param="directory"
delimiter=";" trim="true">
<sequential>
<if>
<available file="@{directory}/@{web.project.dir}"
type="dir" />
<then>
<var name="project.dir"
value="@{directory}/@{web.project.dir}" />
</then>
</if>
</sequential>
</for>
<if>
<equals arg1="${project.dir}" arg2="" />
<then>
<fail message="Failed to find web project: @{web.project.dir}" />
</then>
</if>
<var name="war.file" value="@{war.name}.war" />
<!-- delete old war file -->
<delete dir="@{webapps.dir}/@{war.name}" />
<delete file="@{webapps.dir}/${war.file}" />
<mkdir dir="@{webapps.dir}" />
<!-- build and deploy new war -->
<echo message="Building and deploying war file" />
<war destfile="@{webapps.dir}/${war.file}"
webxml="${project.dir}/web/WEB-INF/web.xml">
<fileset dir="${project.dir}/web"
excludes="**/WEB-INF/" />
<classes dir="${project.dir}/web/WEB-INF/classes" />
<!-- general -->
<webinf file="${project.dir}/web/WEB-INF/dwr.xml" />
</war>
<unzip src="@{webapps.dir}/${war.file}"
dest="@{webapps.dir}/@{war.name}" />
<delete file="@{webapps.dir}/${war.file}" />
</sequential>
</macrodef>
</project>