-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.xml
More file actions
51 lines (44 loc) · 1.64 KB
/
build.xml
File metadata and controls
51 lines (44 loc) · 1.64 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="ToDoListApp" default="run" basedir=".">
<!-- Define variables -->
<property name="src.dir" location="src"/>
<property name="build.dir" location="build"/>
<property name="dist.dir" location="dist"/>
<property name="main.class" value="Main"/>
<!-- Target to clean the build and dist directories -->
<target name="clean">
<echo>Cleaning build and dist directories...</echo>
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- Target to compile the source code -->
<target name="compile" depends="clean">
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.dir}" destdir="${build.dir}">
<include name="**/*.java"/>
</javac>
<echo>Compilation complete.</echo>
</target>
<!-- Target to create a JAR file -->
<target name="jar" depends="compile">
<mkdir dir="${dist.dir}"/>
<jar destfile="${dist.dir}/ToDoListApp.jar" basedir="${build.dir}">
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
<echo>JAR file created in ${dist.dir}/ToDoListApp.jar</echo>
</target>
<!-- Target to run the application -->
<target name="run" depends="compile">
<java classname="${main.class}" fork="true">
<classpath>
<pathelement path="${build.dir}"/>
</classpath>
</java>
</target>
<!-- Target to clean, compile, create JAR, and run the application -->
<target name="full-build" depends="jar,run">
<echo>Full build completed: compiled, packaged, and running the application.</echo>
</target>
</project>