Skip to content

Instantly share code, notes, and snippets.

@das-g
Forked from blt/build.xml
Created July 31, 2011 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save das-g/1117003 to your computer and use it in GitHub Desktop.
Save das-g/1117003 to your computer and use it in GitHub Desktop.
<project name="AgentBridge" basedir="." default="main">
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="main-class" value="com.fluentstream.agentbridge.Main"/>
<property name="lib.dir" value="lib"/>
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<path id="application" location="${jar.dir}/${ant.project.name}.jar"/>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="compile">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}"
classpathref="classpath"/>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}">
<classpath>
<path refid="classpath"/>
<path refid="application"/>
</classpath>
</java>
</target>
<target name="junit" depends="jar">
<junit printsummary="yes">
<classpath>
<path refid="classpath"/>
<path refid="application"/>
</classpath>
<batchtest fork="yes">
<fileset dir="${src.dir}" includes="*Test.java"/>
</batchtest>
</junit>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>
</project>
blt@doritos:~/projects/agentbridge
$ ant compile
Buildfile: /home/blt/projects/agentbridge/build.xml
compile:
[mkdir] Created dir: /home/blt/projects/agentbridge/build/classes
[javac] Compiling 2 source files to /home/blt/projects/agentbridge/build/classes
a
BUILD SUCCESSFUL
Total time: 0 seconds
blt@doritos:~/projects/agentbridge
$ ant jar
Buildfile: /home/blt/projects/agentbridge/build.xml
compile:
jar:
[mkdir] Created dir: /home/blt/projects/agentbridge/build/jar
[jar] Building jar: /home/blt/projects/agentbridge/build/jar/AgentBridge.jar
BUILD SUCCESSFUL
Total time: 0 seconds
blt@doritos:~/projects/agentbridge
$ ant junit
Buildfile: /home/blt/projects/agentbridge/build.xml
compile:
jar:
junit:
BUILD FAILED
/home/blt/projects/agentbridge/build.xml:45: Reference application not found. <-- This should be fixed with this change
Total time: 0 seconds
blt@doritos:~/projects/agentbridge
$ tree
.
├── agentbridge.proto
├── build
│   ├── classes
│   │   ├── com
│   │   │   └── fluentstream
│   │   │   └── agentbridge
│   │   │   └── Main.class
│   │   └── MainTest.class
│   └── jar
│   └── AgentBridge.jar
├── build.xml
├── client.cpp
├── lib
│   ├── ant-junit.jar
│   ├── junit.jar
│   └── log4j-1.2.16.jar
├── Makefile
├── README
├── server.cpp
└── src
├── com
│   └── fluentstream
│   └── agentbridge
│   └── Main.java
└── MainTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment