This repository has been archived by the owner on Jun 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.xml
executable file
·94 lines (80 loc) · 3.49 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?xml version="1.0" encoding="UTF-8"?>
<project name="jtrade" default="jar" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<property environment="env" />
<property name="src" value="./src/main/java" />
<property name="build" value="./build" />
<property name="dist" value="./dist" />
<property name="deps" value="./lib" />
<property name="testsrc" value="./src/test/java" />
<property name="testoutput" value="./test/output" />
<taskdef name="testng" classname="org.testng.TestNGAntTask" />
<target name="ivy">
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.home}/${ivy.jar.name}"/>
<ivy:resolve/>
</target>
<target name="init" depends="ivy">
<tstamp />
<mkdir dir="${deps}" />
<mkdir dir="${build}" />
<mkdir dir="${dist}" />
<mkdir dir="${testoutput}" />
</target>
<target name="clean">
<delete includeEmptyDirs="true">
<fileset dir="${build}" />
</delete>
</target>
<target name="fetchdeps" description="Fetch dependencies with ivy">
<ivy:settings file="ivysettings.xml" />
<ivy:retrieve />
</target>
<target name="classpath" description="Assemble classpath">
<path id="libClasspath">
<fileset dir="${deps}">
<include name="**/*.jar" />
</fileset>
</path>
</target>
<target name="compile" description="Compile project" depends="init, classpath">
<javac destdir="${build}" target="1.7" source="1.7" debug="true" deprecation="false" optimize="true" failonerror="true" includeantruntime="false">
<src path="${src}" />
<classpath refid="libClasspath" />
<!-- <compilerarg value="-Xlint:unchecked"/>-->
<!-- <compilerarg value="-Xlint:deprecation"/>-->
</javac>
</target>
<target name="copyresources" description="Copy project resources to build dir" depends="init">
<copy todir="${build}" includeEmptyDirs="false">
<fileset dir="${src}" />
</copy>
</target>
<target name="jar" description="Create jar" depends="init, compile, copyresources">
<jar jarfile="${dist}/${ant.project.name}.jar" includes="**/*" excludes="**/*.java" basedir="${build}" />
<jar jarfile="${dist}/${ant.project.name}-sources.jar" includes="**/*" excludes="**/*.class" basedir="${build}" />
</target>
<target name="pom">
<ivy:makepom ivyfile="ivy.xml" pomfile="${dist}/${ant.project.name}.pom">
<mapping conf="default" scope="compile"/>
</ivy:makepom>
</target>
<target name="publish" depends="jar, pom" description="publish to local m2 repos">
<ivy:publish resolver="localmaven-publish" forcedeliver="true" overwrite="true" publishivy="false">
<artifacts pattern="${dist}/[artifact](-[classifier]).[ext]"/>
</ivy:publish>
</target>
<target name="compiletest" description="Compile tests for project" depends="init, classpath">
<javac destdir="${build}" target="1.7" source="1.7" debug="true" deprecation="false" optimize="true" failonerror="true" includeantruntime="false">
<src path="${testsrc}" />
<classpath refid="libClasspath" />
<!-- <compilerarg value="-Xlint:unchecked"/>-->
<!-- <compilerarg value="-Xlint:deprecation"/>-->
</javac>
</target>
<target name="test" description="Run tests" depends="compile, compiletest">
<testng outputDir="${testoutput}" haltOnFailure="true" verbose="2">
<classpath location="${build}" />
<classfileset dir="${build}/" includes="**/test/**/*.class" excludes="eclipse/**/*" />
<classpath refid="libClasspath" />
</testng>
</target>
</project>