| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
|
| 3 |
<project name="build" default="all" basedir="."> |
| 4 |
|
| 5 |
<property name="war.name" value="s2helloworld"/> |
| 6 |
<property name="src.main.webapp.webinf.classes" value="${basedir}/src/main/webapp/WEB-INF/classes"/> |
| 7 |
<property name="src.main.webapp.webinf.lib" value="${basedir}/src/main/webapp/WEB-INF/lib"/> |
| 8 |
<property name="target.webapp.webinf.lib" value="${basedir}/target/${war.name}/WEB-INF/lib"/> |
| 9 |
<property name="target.webapp.webinf.classes" value="${basedir}/target/${war.name}/WEB-INF/classes"/> |
| 10 |
|
| 11 |
<property name="shell.cmd" value="sh"/> |
| 12 |
<property name="shell.options" value="-c"/> |
| 13 |
|
| 14 |
<target name="check.os" |
| 15 |
description="--> Check OS"> |
| 16 |
<condition property="isWindows"> |
| 17 |
<os family="windows" /> |
| 18 |
</condition> |
| 19 |
</target> |
| 20 |
|
| 21 |
<target name="setup.shell" depends="check.os" if="isWindows" |
| 22 |
description="--> Setup shell parameters"> |
| 23 |
<property name="shell.cmd" value="cmd.exe"/> |
| 24 |
<property name="shell.options" value="/c"/> |
| 25 |
</target> |
| 26 |
|
| 27 |
<target name="clean" |
| 28 |
description="--> Clean Directories"> |
| 29 |
<delete dir="${src.main.webapp.webinf.classes}"/> |
| 30 |
<delete dir="${src.main.webapp.webinf.lib}"/> |
| 31 |
</target> |
| 32 |
|
| 33 |
<!-- =================================================================== --> |
| 34 |
<!-- SERVLET DEVELOPMENT ENVRIONMENT --> |
| 35 |
<!-- =================================================================== --> |
| 36 |
|
| 37 |
<target name="servlet" depends="setup.shell,clean" |
| 38 |
description="--> Setup Servlet Delopment Environment"> |
| 39 |
|
| 40 |
<delete dir="${basedir}/target"/> |
| 41 |
<delete dir="${basedir}/work"/> |
| 42 |
|
| 43 |
<!-- pom.xml --> |
| 44 |
<replace |
| 45 |
file="${basedir}/pom.xml" |
| 46 |
token="<!-- SERVLET DEV: BEGIN @@@" |
| 47 |
value="<!-- SERVLET DEV: BEGIN -->" |
| 48 |
> |
| 49 |
</replace> |
| 50 |
<replace |
| 51 |
file="${basedir}/pom.xml" |
| 52 |
token="@@@@ SERVLET DEV: END -->" |
| 53 |
value="<!-- SERVLET DEV: END -->" |
| 54 |
> |
| 55 |
</replace> |
| 56 |
|
| 57 |
<!-- web.xml --> |
| 58 |
<replace |
| 59 |
file="${basedir}/src/main/webapp/WEB-INF/web.xml" |
| 60 |
token="<!-- SERVLET DEV: BEGIN @@@" |
| 61 |
value="<!-- SERVLET DEV: BEGIN -->" |
| 62 |
> |
| 63 |
</replace> |
| 64 |
<replace |
| 65 |
file="${basedir}/src/main/webapp/WEB-INF/web.xml" |
| 66 |
token="@@@@ SERVLET DEV: END -->" |
| 67 |
value="<!-- SERVLET DEV: END -->" |
| 68 |
> |
| 69 |
</replace> |
| 70 |
|
| 71 |
<exec |
| 72 |
executable="${shell.cmd}" |
| 73 |
failonerror="true" |
| 74 |
dir="${basedir}" |
| 75 |
> |
| 76 |
<arg line="${shell.options} 'mvn install'"/> |
| 77 |
</exec> |
| 78 |
|
| 79 |
<mkdir dir="${src.main.webapp.webinf.classes}"/> |
| 80 |
<mkdir dir="${src.main.webapp.webinf.lib}"/> |
| 81 |
|
| 82 |
<copy todir="${src.main.webapp.webinf.lib}"> |
| 83 |
<fileset dir="${target.webapp.webinf.lib}"> |
| 84 |
<include name="*.jar"/> |
| 85 |
</fileset> |
| 86 |
</copy> |
| 87 |
<copy todir="${src.main.webapp.webinf.classes}"> |
| 88 |
<fileset dir="${target.webapp.webinf.classes}"> |
| 89 |
<include name="**"/> |
| 90 |
</fileset> |
| 91 |
</copy> |
| 92 |
|
| 93 |
<delete dir="${basedir}/target"/> |
| 94 |
|
| 95 |
</target> |
| 96 |
|
| 97 |
<!-- =================================================================== --> |
| 98 |
<!-- PORTLET DEVELOPMENT ENVRIONMENT --> |
| 99 |
<!-- =================================================================== --> |
| 100 |
|
| 101 |
<target name="portlet" depends="setup.shell,clean" |
| 102 |
description="--> Setup Portlet Delopment Environment"> |
| 103 |
|
| 104 |
<delete dir="${basedir}/target"/> |
| 105 |
<delete dir="${basedir}/work"/> |
| 106 |
|
| 107 |
<!-- pom.xml --> |
| 108 |
<replace |
| 109 |
file="${basedir}/pom.xml" |
| 110 |
token="<!-- SERVLET DEV: BEGIN -->" |
| 111 |
value="<!-- SERVLET DEV: BEGIN @@@" |
| 112 |
> |
| 113 |
</replace> |
| 114 |
<replace |
| 115 |
file="${basedir}/pom.xml" |
| 116 |
token="<!-- SERVLET DEV: END -->" |
| 117 |
value="@@@@ SERVLET DEV: END -->" |
| 118 |
> |
| 119 |
</replace> |
| 120 |
|
| 121 |
<!-- web.xml --> |
| 122 |
<replace |
| 123 |
file="${basedir}/src/main/webapp/WEB-INF/web.xml" |
| 124 |
token="<!-- SERVLET DEV: BEGIN -->" |
| 125 |
value="<!-- SERVLET DEV: BEGIN @@@" |
| 126 |
> |
| 127 |
</replace> |
| 128 |
<replace |
| 129 |
file="${basedir}/src/main/webapp/WEB-INF/web.xml" |
| 130 |
token="<!-- SERVLET DEV: END -->" |
| 131 |
value="@@@@ SERVLET DEV: END -->" |
| 132 |
> |
| 133 |
</replace> |
| 134 |
|
| 135 |
</target> |
| 136 |
|
| 137 |
</project> |
| 138 |
|