PageRenderTime 16ms CodeModel.GetById 2ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/asl/asl-java-war.xml

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
XML | 81 lines | 42 code | 9 blank | 30 comment | 0 complexity | 62f75d2be519c559c1070bf46866b026 MD5 | raw file
 1<?xml version="1.0" encoding="utf-8"?> 
 2<!--
 3********************************************************************************
 4* Ant Script Library - Java war module 
 5* Targets to create a war
 6* Module property prefix: "java-war"
 7********************************************************************************
 8* Copyright 2009 Joe Schmetzer
 9*
10* Licensed under the Apache License, Version 2.0 (the "License");
11* you may not use this file except in compliance with the License.
12* You may obtain a copy of the License at
13*
14*     http://www.apache.org/licenses/LICENSE-2.0
15*
16* Unless required by applicable law or agreed to in writing, software
17* distributed under the License is distributed on an "AS IS" BASIS,
18* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19* See the License for the specific language governing permissions and
20* limitations under the License.
21********************************************************************************
22 -->
23<project name="asl-java-war">
24    <dirname property="asl-java-war.basedir" file="${ant.file.asl-java-war}"/>
25
26    <import file="${asl-java-war.basedir}/asl-java-build.xml"/>
27
28    <property name="java-war.dist-filename"     value="${ant.project.name}.war"/>
29    <property name="java-war.dist-file"         location="${common.dist-dir}/${java-war.dist-filename}"/>
30    <property name="java-war.web-xml-file"      location="src/metadata/myapp.xml"/>
31    <property name="java-war.libs-dir"          location="${common.target-dir}/war-libs"/>
32    <property name="java-war.web-content-dir"   location="src/main/webapp"/>
33    <property name="java-war.web-xml"           location="web.xml"/>
34    <property name="java-war.webapp-name"       location="${ant.project.name}"/>
35    <property name="java-war.deploy-base"       location="${tomcat.home}/webapps"/>
36    <property name="java-war.deploy-dir"        location="${java-war.deploy-base}/${java-war.webapp-name}"/>
37
38    <!-- ***********************************************************************
39    * target: war
40    ************************************************************************ -->
41    <target name="war" depends="compile, copy-resources, jar, -init-time, -war-prepare-libs"
42            description="Create a war for this web project">
43            
44        <mkdir dir="${common.dist-dir}"/>
45        
46        <property name="java-war.compress"    value="true"/>
47        <property name="java-war.build-id"    value="Built by ${user.name} at ${common.timestamp} running on ${os.name} ${os.version} ${os.arch}"/>
48        
49        <war destfile="${java-war.dist-file}"
50                webxml="${java-war.web-xml-file}"
51                compress="${java-war.compress}">
52            <fileset dir="${java-war.web-content-dir}" />
53            <manifest>
54                <attribute name="Build-Id" value="${java-war.build-id}"/>
55            </manifest>
56            <lib dir="${java-war.libs-dir}"/>
57        </war>
58    </target>
59
60    <!-- ***********************************************************************
61    * target: -war-prepare-libs
62    ************************************************************************ -->
63    <target name="-war-prepare-libs">
64        <mkdir dir="${java-war.libs-dir}"/>
65        <copy todir="${java-war.libs-dir}">
66            <path refid="java-build.classpath"/>
67            <mapper type="flatten"/>
68        </copy>
69        <copy todir="${java-war.libs-dir}" file="${java-build.jar-file}"/>
70    </target>
71
72    <!-- ***********************************************************************
73    * target: war-deploy
74    ************************************************************************ -->
75    <target name="war-deploy" depends="war"
76            description="Deploys the war to the application server">
77        <unwar src="${java-war.dist-file}"
78               dest="${java-war.deploy-dir}"/>
79    </target>
80
81</project>