nbproject/ant-deploy.xml

Wed, 29 Mar 2017 15:03:25 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 29 Mar 2017 15:03:25 +0200
changeset 0
ad22b29e3a40
child 3
acf54d3fa1d1
permissions
-rw-r--r--

project initialization

universe@0 1 <?xml version="1.0" encoding="UTF-8"?>
universe@0 2 <project default="-deploy-ant" basedir=".">
universe@0 3 <target name="-init-cl-deployment-env" if="deploy.ant.enabled">
universe@0 4 <property file="${deploy.ant.properties.file}" />
universe@0 5 <available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
universe@0 6 <available file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" property="glassfish.web.present"/>
universe@0 7 <available file="${deploy.ant.resource.dir}" property="has.setup"/>
universe@0 8 <tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
universe@0 9 <echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
universe@0 10 </target>
universe@0 11
universe@0 12 <target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
universe@0 13 <tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
universe@0 14 <copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
universe@0 15 <!-- The doctype triggers resolution which can fail -->
universe@0 16 <replace file="${temp.sun.web}">
universe@0 17 <replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
universe@0 18 <replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
universe@0 19 </replace>
universe@0 20 <replace file="${temp.sun.web}">
universe@0 21 <replacetoken><![CDATA[<sun-web-app]]></replacetoken>
universe@0 22 <replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
universe@0 23 </replace>
universe@0 24 <xmlproperty file="${temp.sun.web}" validate="false">
universe@0 25 </xmlproperty>
universe@0 26 <delete file="${temp.sun.web}"/>
universe@0 27 <condition property="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
universe@0 28 <isset property="sun-web-app.context-root"/>
universe@0 29 </condition>
universe@0 30 <condition property="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}" else="/${ant.project.name}">
universe@0 31 <isset property="sun-web-app.context-root"/>
universe@0 32 </condition>
universe@0 33 </target>
universe@0 34 <target name="-parse-glassfish-web" depends="-init-cl-deployment-env" if="glassfish.web.present">
universe@0 35 <tempfile prefix="gfv3" property="temp.gf.web" destdir="${java.io.tmpdir}"/>
universe@0 36 <copy file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" tofile="${temp.gf.web}"/>
universe@0 37 <!-- The doctype triggers resolution which can fail -->
universe@0 38 <replace file="${temp.gf.web}">
universe@0 39 <replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
universe@0 40 <replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
universe@0 41 </replace>
universe@0 42 <replace file="${temp.gf.web}">
universe@0 43 <replacetoken><![CDATA[<glassfish-web-app]]></replacetoken>
universe@0 44 <replacevalue><![CDATA[--> <glassfish-web-app]]></replacevalue>
universe@0 45 </replace>
universe@0 46 <xmlproperty file="${temp.gf.web}" validate="false">
universe@0 47 </xmlproperty>
universe@0 48 <delete file="${temp.gf.web}"/>
universe@0 49 <condition property="deploy.ant.client.url" value="${gfv3.url}${glassfish-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
universe@0 50 <isset property="glassfish-web-app.context-root"/>
universe@0 51 </condition>
universe@0 52 <condition property="deploy.context.root.argument" value="&amp;contextroot=${glassfish-web-app.context-root}" else="/${ant.project.name}">
universe@0 53 <isset property="glassfish-web-app.context-root"/>
universe@0 54 </condition>
universe@0 55 </target>
universe@0 56 <target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
universe@0 57 <property name="deploy.context.root.argument" value=""/>
universe@0 58 </target>
universe@0 59 <target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
universe@0 60 <tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
universe@0 61 <mkdir dir="${gfv3.resources.dir}"/>
universe@0 62 <mkdir dir="${gfv3.resources.dir}/META-INF"/>
universe@0 63 <copy todir="${gfv3.resources.dir}/META-INF">
universe@0 64 <fileset dir="${deploy.ant.resource.dir}"/>
universe@0 65 </copy>
universe@0 66 <jar destfile="${deploy.ant.archive}" update="true">
universe@0 67 <fileset dir="${gfv3.resources.dir}"/>
universe@0 68 </jar>
universe@0 69 <delete dir="${gfv3.resources.dir}"/>
universe@0 70 </target>
universe@0 71 <target name="-deploy-ant" depends="-parse-glassfish-web, -parse-sun-web, -no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
universe@0 72 <antcall target="-deploy-without-pw"/>
universe@0 73 <antcall target="-deploy-with-pw"/>
universe@0 74 </target>
universe@0 75
universe@0 76 <target name="-deploy-without-pw" unless="gfv3.password">
universe@0 77 <echo message="Deploying ${deploy.ant.archive}"/>
universe@0 78 <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
universe@0 79 <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
universe@0 80 <get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
universe@0 81 dest="${gfv3.results.file}"/>
universe@0 82 <delete file="${gfv3.results.file}"/>
universe@0 83 </target>
universe@0 84 <target name="-deploy-with-pw" if="gfv3.password">
universe@0 85 <echo message="Deploying ${deploy.ant.archive}"/>
universe@0 86 <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
universe@0 87 <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
universe@0 88 <get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
universe@0 89 dest="${gfv3.results.file}"/>
universe@0 90 <delete file="${gfv3.results.file}"/>
universe@0 91 </target>
universe@0 92 <target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
universe@0 93 <antcall target="-undeploy-without-pw"/>
universe@0 94 <antcall target="-undeploy-with-pw"/>
universe@0 95 </target>
universe@0 96
universe@0 97 <target name="-undeploy-without-pw" unless="gfv3.password">
universe@0 98 <echo message="Undeploying ${deploy.ant.archive}"/>
universe@0 99 <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
universe@0 100 <get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
universe@0 101 dest="${gfv3.results.file}"/>
universe@0 102 <delete file="${gfv3.results.file}"/>
universe@0 103 </target>
universe@0 104 <target name="-undeploy-with-pw" if="gfv3.password">
universe@0 105 <echo message="Undeploying ${deploy.ant.archive}"/>
universe@0 106 <tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
universe@0 107 <get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
universe@0 108 dest="${gfv3.results.file}"/>
universe@0 109 <delete file="${gfv3.results.file}"/>
universe@0 110 </target>
universe@0 111 </project>

mercurial