Initial version of ant project a.k.a xml programming.

master
Tomasz Półgrabia 2022-10-03 21:44:45 +02:00
commit 0e031849a2
6 changed files with 82 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
lib/
target/

64
build.xml Normal file
View File

@ -0,0 +1,64 @@
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="ant_demo1" default="run">
<property name="dist" location="target" />
<property name="src" location="src" />
<property name="srcJava" location="${src}/main/java" />
<property name="libs" location="lib/" />
<target name="resolve-ivy-deps" description="Resolving dependencies">
<ivy:retrieve />
</target>
<target name="download-ivy" description="Download ivy">
<mkdir dir="${user.home}/.ant/lib" />
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/2.5.0/ivy-2.5.0.jar"
dest="${user.home}/.ant/lib/"
verbose="off"
quiet="true" />
</target>
<target name="init" description="init build" depends="download-ivy" />
<target name="deps" depends="resolve-ivy-deps" />
<target name="copy-resources">
<mkdir dir="${dist}/exploded" />
<copy toDir="${dist}/exploded">
<fileset dir="${src}/main/resources/" />
<dirset dir="${src}/main/resources/" />
</copy>
</target>
<target name="compile-classes">
<mkdir dir="${dist}/classes" />
<javac srcdir="${srcJava}" destdir="${dist}/classes" />
<copy toDir="${dist}/exploded">
<fileset dir="${dist}/classes/" />
<dirset dir="${dist}/classes/" />
</copy>
</target>
<target name="package-jar">
<jar basedir="${dist}/exploded"
destfile="${dist}/libs/lib.jar"
filesetmanifest="merge" />
</target>
<target name="build"
description="build">
<antcall target="deps" />
<antcall target="copy-resources" />
<antcall target="compile-classes" />
<antcall target="package-jar" />
</target>
<target name="clean" description="clean">
<delete dir="${dist}" />
</target>
<target name="run" description="default runner" depends="build" />
</project>

7
ivy.xml Normal file
View File

@ -0,0 +1,7 @@
<ivy-module version="2.0">
<info organisation="ch.polgrabia.demos" module="ant_demo1" />
<dependencies>
<dependency org="commons-lang" name="commons-lang" rev="2.0" />
<dependency org="commons-cli" name="commons-cli" rev="1.0" />
</dependencies>
</ivy-module>

View File

@ -0,0 +1,5 @@
public class Program {
public static void main(String[] args) {
System.out.println("Hello World!!!");
}
}

View File

@ -0,0 +1 @@
Main-Class: Program

View File

@ -0,0 +1,3 @@
<web>
</web>