summaryrefslogtreecommitdiff
path: root/ant/tomcat-common.xml
blob: dc2ace9bf5301cc6af87c0ad6da52e0f68f26071 (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<project name="tomcat-common">

    <property file="${user.home}/opt/tomcat/conf/build.properties"/>
    
    <property name="web.dir" value="web" />
    
    <property name="build.classes" value="WEB-INF/classes" />
    
    <property name="context.path"  value="/${ant.project.name}"/>
    <property name="manager.url"   value="http://localhost:8080/manager/text"/>
    
    <import file="build-common.xml" />
    
    <path id="catalina-ant-classpath">
        <fileset dir="${catalina.home}/bin" erroronmissingdir="false">
            <include name="*.jar"/>
        </fileset>
        
        <fileset dir="${catalina.home}/lib" erroronmissingdir="false">
            <!-- <include name="*.jar"/> -->
        </fileset>
    </path>

    <taskdef resource="org/apache/catalina/ant/catalina.tasks"
        classpathref="catalina-ant-classpath" onerror="report" />
       
    <target name="prepare" depends="build-common.prepare"
        description="Create the build directories">
        
        <copy todir="${build.dir}">
            <fileset dir="${web.dir}" />
        </copy>
        <copy todir="${build.dir}/WEB-INF/lib">
            <fileset dir="${lib.dir}" />
        </copy>
    </target>

    <target name="war" depends="build" description="Generate WAR">
        <war destfile="build/${ant.project.name}.war" webxml="${web.dir}/WEB-INF/web.xml">
            <fileset dir="${web.dir}" />
            <lib dir="${lib.dir}" />
            <classes dir="${build.dir}/${build.classes}" />
        </war>
    </target>

    <target name="install" depends="build"
        description="Install application to servlet container">

        <deploy
            url="${manager.url}"
            username="${manager.username}"
            password="${manager.password}"
            path="${context.path}"
            localWar="file://${basedir}/${build.dir}" />

    </target>

    <target name="list"
        description="List installed applications on servlet container">

        <list
            url="${manager.url}"
            username="${manager.username}"
            password="${manager.password}" />

    </target>

    <target name="reload" depends="build"
        description="Reload application on servlet container">

        <reload 
            url="${manager.url}"
            username="${manager.username}"
            password="${manager.password}"
            path="${context.path}"/>

    </target>

    <target name="uninstall"
        description="Remove application on servlet container">

        <undeploy 
            url="${manager.url}"
            username="${manager.username}"
            password="${manager.password}"
            path="${context.path}"/>

    </target>

    <target name="setup-tomcat" unless="catalina.home">
        <input message="Enter a tomcat password (stored in plaintext):"
            addproperty="manager.password" />
        <exec executable="${jesterpm.buildtools.root}/scripts/setup-tomcat.sh"
            inputstring="${manager.password}">
            <arg line="${manager.password}" />
        </exec>
    </target>

</project>