Friday, August 31, 2018

Using Apache Ant in Netbeans

The following ant code is run inside the -post-jar target in a Netbeans Java project.

    Copy the .jar file and the zipped directory dist
    to deploy folder in Z: drive


<echo message="Zip and copy: ${application.title}" />
    A file name property for the zip file we are going to create
<local name="zipfile" />
<property name="zipfile" value="${application.title}" />

<!-- The creation of the zip file -->
<zip destfile="${zipfile}">
     <fileset dir="${dist.dir}/" />
<!-- Copying the 2 files -->
     <copy todir="Z:/deploy" overwrite="true">
             <file file="${dist.jar}" />
             <file file="${zipfile}" />

<delete file="${zipfile}" />
<!-- End of the copy -->

No comments: