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