Ant Script

Basic build.xml example:

<?xml version="1.0" encoding="UTF-8"?>

<project name="IntelliNews" default="compile" basedir=".">

  <property name="src" location="src"/>
  <property name="lib" location="lib"/>
  <property name="build" location="build"/>
  <property name="build.classes" location="${build}/classes"/>
  <property name="build.lib" location="${build}/lib"/>
  <property name="dist"  location="dist"/>
  <property name="dist.lib" location="${dist}/lib"/>

  <property file="${src}/db.properties"/>

  <path id="libraries">
    <fileset dir="${lib}">
      <include name="*.jar"/>
    </fileset>
  </path>

  <target name="clean">
    <delete dir="${build}"/>
    <mkdir dir="${build}"/>
    <defaultexcludes remove="**/*~" />
    <delete verbose="true">
      <fileset dir="${src}">
        <include name="**/*.*~"/>
      </fileset>
    </delete>
    <defaultexcludes default="true" />
  </target>

  <target name="copy-resources">
    <copy todir="${build}">
      <fileset dir="${src}">
        <exclude name="**/*.java"/>
      </fileset>
    </copy>
  </target>

  <target name="compile" depends="copy-resources">
    <javac srcdir="${src}"
           destdir="${build}"
           classpathref="libraries"
       debug="on" 
       includeantruntime="false">
      <compilerarg value="-Xlint:unchecked"/>
      <compilerarg value="-Xlint:deprecation"/>
    </javac>
  </target>

  <target name="run" depends="compile">
    <java classname="com.redmind.ai.intellinews.Main"
      fork="true" classpathref="libraries">     
      <classpath path="${build}"/>
    </java>
  </target>

  <target name="create-mysql-database">
    <sql driver="${DB.DRIVER}" url="${DB.URL.NEWDATABASE}" userid="${DB.USER}"
         password="${DB.PASSWORD}" classpathref="libraries"
         delimiter="${DB.DELIMITER}" autocommit="false" onerror="continue">
      create database ${DB.SID};
    </sql>

  </target>
</project>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License