Category Archives: build_tools

Ant: Simple build file


<?xml version="1.0"?>
<project name="ant test project" default="dist" basedir=".">

	<property name="src" location="src"/>
	<property name="build" location="build"/>
	<property name="dist"  location="dist"/>

	<target name="init">
		<mkdir dir="${build}"/>

	<target name="compile" depends="init" >
		<javac srcdir="${src}" destdir="${build}"/>
	 <target name="dist" depends="compile" >
		<mkdir dir="${dist}/lib"/>
		<jar jarfile="${dist}/lib/${DSTAMP}-${TSTAMP}.jar" basedir="${build}"/>
	<target name="clean" description="clean up" >
		<delete dir="${build}"/>
		<delete dir="${dist}"/>

To run this

>ant -f build.xml
for specific task (eg. clean)
>ant -f build.xml clean

Maven : Creating simple project

  1. create a folder for the test project (D:\sandbox\junk)
  2. exceute the following from that folder
    • mvn archetype:create -DgroupId=sam.test -DartifactId=mvntest
    • Let it download some jar files
    • [INFO] Parameter: groupId, Value: sam.test
      [INFO] Parameter: packageName, Value: sam.test
      [INFO] Parameter: package, Value: sam.test
      [INFO] Parameter: artifactId, Value: mvntest
      [INFO] Parameter: basedir, Value: d:\SANDBOX\junk
      [INFO] Parameter: version, Value: 1.0-SNAPSHOT
      [INFO] project created from Old (1.x) Archetype in dir: d:\SANDBOX\junk\mvntest
      [INFO] ------------------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 3 minutes 50 seconds
      [INFO] Finished at: Thu Mar 08 18:12:49 IST 2012
      [INFO] Final Memory: 12M/31M
      [INFO] ------------------------------------------------------------------------
    • pom.xml
      <project xmlns="" xmlns:xsi=""
  3. How to perform an archetype:create from Eclipse
  4. Importing Maven 2 project to Eclipse

Installing Maven

  1. Download Maven 2.2.1
  2. Unzip it to somewhere convenient (D:\TOOLS\apache-maven-2.2.1)
  3. Add M2_HOME system variable
    • Variable Name : M2_HOME
    • Variable Value : D:\TOOLS\apache-maven-2.2.1
  4. Modify Path variable, add %M2_HOME%\bin; at the end of the Variable value field
  5. To verify, open a CMD and type mvn -version