java/nekurak.net-web/nbproject/ant-deploy.xml
author František Kučera <franta-hg@frantovo.cz>
Sat, 19 Dec 2009 18:17:39 +0100
changeset 0 b85f351aa5e5
child 6 e6581bb3c4a3
permissions -rw-r--r--
Založen projekt v Netbeans + první J2EE stránka.
franta-hg@0
     1
<?xml version="1.0" encoding="UTF-8"?>
franta-hg@0
     2
<project default="-deploy-ant" basedir=".">
franta-hg@0
     3
    <target name="-init-cl-deployment-env" if="deploy.ant.enabled">
franta-hg@0
     4
        <property file="${deploy.ant.properties.file}" />
franta-hg@0
     5
        <available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
franta-hg@0
     6
        <available file="${deploy.ant.resource.dir}" property="has.setup"/>
franta-hg@0
     7
        <tempfile prefix="sjsas" property="sjsas.password.file" destdir="${java.io.tmpdir}"/>  <!-- do not forget to delete this! -->
franta-hg@0
     8
        <echo message="AS_ADMIN_PASSWORD=${sjsas.password}" file="${sjsas.password.file}"/>
franta-hg@0
     9
    </target>
franta-hg@0
    10
    
franta-hg@0
    11
    <target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
franta-hg@0
    12
        <tempfile prefix="sjsas" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
franta-hg@0
    13
        <copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
franta-hg@0
    14
        <!-- The doctype triggers resolution which can fail -->
franta-hg@0
    15
        <replace file="${temp.sun.web}">
franta-hg@0
    16
            <replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
franta-hg@0
    17
            <replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
franta-hg@0
    18
        </replace>
franta-hg@0
    19
        <replace file="${temp.sun.web}">
franta-hg@0
    20
            <replacetoken><![CDATA[<sun-web-app]]></replacetoken>
franta-hg@0
    21
            <replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
franta-hg@0
    22
        </replace>
franta-hg@0
    23
        <xmlproperty file="${temp.sun.web}" validate="false">
franta-hg@0
    24
        </xmlproperty>    
franta-hg@0
    25
        <delete file="${temp.sun.web}"/>
franta-hg@0
    26
        <property name="deploy.ant.client.url" value="${sjsas.url}${sun-web-app.context-root}"/>
franta-hg@0
    27
    </target>
franta-hg@0
    28
    <target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
franta-hg@0
    29
        <tempfile prefix="sjsas" property="sjsas.resources.dir" destdir="${java.io.tmpdir}"/>
franta-hg@0
    30
        <mkdir dir="${sjsas.resources.dir}"/>
franta-hg@0
    31
        <mkdir dir="${sjsas.resources.dir}/META-INF"/>
franta-hg@0
    32
        <property name="sjsas.resources.file" value="${sjsas.resources.dir}/META-INF/sun-resources.xml"/>
franta-hg@0
    33
        <copy todir="${sjsas.resources.dir}/META-INF">
franta-hg@0
    34
            <fileset dir="${deploy.ant.resource.dir}"/>
franta-hg@0
    35
        </copy>
franta-hg@0
    36
        <jar destfile="${deploy.ant.archive}" update="true">
franta-hg@0
    37
            <fileset dir="${sjsas.resources.dir}"/>
franta-hg@0
    38
        </jar>
franta-hg@0
    39
        <delete dir="${sjsas.resources.dir}"/>
franta-hg@0
    40
    </target>
franta-hg@0
    41
    <target name="-deploy-ant" depends="-parse-sun-web,-add-resources" if="deploy.ant.enabled">
franta-hg@0
    42
        <echo message="Deploying ${deploy.ant.archive}"/>
franta-hg@0
    43
        <taskdef name="sun-appserv-deploy" classname="org.apache.tools.ant.taskdefs.optional.sun.appserv.DeployTask"
franta-hg@0
    44
                 classpath="${sjsas.root}/lib/sun-appserv-ant.jar" />
franta-hg@0
    45
        <sun-appserv-deploy user="${sjsas.username}"
franta-hg@0
    46
                passwordfile="${sjsas.password.file}"
franta-hg@0
    47
                host="${sjsas.host}" port="${sjsas.port}"
franta-hg@0
    48
                file="${deploy.ant.archive}" asinstalldir="${sjsas.root}"/>
franta-hg@0
    49
        <delete file="${sjsas.password.file}"/>
franta-hg@0
    50
    </target>
franta-hg@0
    51
    <target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
franta-hg@0
    52
        <taskdef name="sun-appserv-undeploy" classname="org.apache.tools.ant.taskdefs.optional.sun.appserv.UndeployTask"
franta-hg@0
    53
                 classpath="${sjsas.root}/lib/sun-appserv-ant.jar" />
franta-hg@0
    54
        <sun-appserv-undeploy user="${sjsas.username}"
franta-hg@0
    55
                passwordfile="${sjsas.password.file}"
franta-hg@0
    56
                host="${sjsas.host}" port="${sjsas.port}"
franta-hg@0
    57
                file="${deploy.ant.archive}" asinstalldir="${sjsas.root}"/>
franta-hg@0
    58
        <delete file="${sjsas.password.file}"/>
franta-hg@0
    59
    </target>
franta-hg@0
    60
</project>