Java Web Projesi için Ant Script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<project name="projectname"  basedir=".">
       <property name="lib.dir" value="lib"/>
       <property name="src.dir" value="src"/>
       <property name="web.dir" value="web"/>
       <property name="build.dir" value="build"/>
       <property name="deploy.dir" value="deploy"/>
       <property name="war.file" value="${deploy.dir}/deployfile.war"/>

       <path id="myclasspath">
               <pathelement location="${build.dir}"/>
               <fileset dir="${lib.dir}" includes="**/*.jar"/>
       </path>

       <target name="init">
               <mkdir dir="${build.dir}" />
               <mkdir dir="${deploy.dir}" />
       </target>

       <target name="clean" >
           <delete dir="${build.dir}"/>
           <delete dir="${deploy.dir}"/>
       </target>

       <target name="compile">
               <echo message="Compiling...." />
               <javac srcdir="${src.dir}" destdir="${build.dir}"  >
                       <classpath refid="myclasspath" />
               </javac>
       </target>

       <target name="build" depends="init,compile">
               <war destfile="${war.file}" webxml="${web.dir}/WEB-INF/web.xml">
                       <fileset dir="${web.dir}" />
                       <lib dir="${lib.dir}" />
                       <classes dir="${build.dir}" />
               </war>
       </target>
</project>

Leave a Reply