Hi i'm new to apache ant and ivy.i recently known ant does not support dependency management.so i hear about IVY ,a dependency manager for ant.Now the problem is , i have added ivy dependency to ivy.xml file
<ivy-module version="2.0">
<info organisation="com.mlen" module="testApp"/>
<dependencies>
<dependency org="net.sourceforge.jdatepicker" name="jdatepicker" rev="1.3.2"/>
</dependencies>
</ivy-module>
Which is a jdatepicker for swing application. Now the problem is when i try to access the dependency class, it does not import classes. ivy downloaded the dependency to lib folder under project dir.
My build.xml file
<project name="HelloWorld"
basedir="."
default="run">
<!-- xmlns:ivy="antlib:org.apache.ivy.ant">-->
<property name="src.dir" value="src"/>
<property name="lib.dir" value="lib"/>
<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.mlen.testApp.HelloWorld"/>
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
<ivy:retrieve/>
</target>
<target name="compile" depends="resolve">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
<copy todir="${classes.dir}">
<fileset dir="${src.dir}" excludes="**/*.java"/>
</copy>
</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}"/>
<!--how can i get ivy to note what the class path should be?-->
<attribute name="Class-Path" value="log4j-1.2.17.jar"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}">
<classpath>
<path refid="classpath"/>
<path location="${jar.dir}/${ant.project.name}.jar"/>
</classpath>
</java>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>
</project>
And finally my main class.
public class HelloWorld extends JFrame {
public HelloWorld(){
UtilDateModel model = new UtilDateModel();
JDatePanelImpl datePanel = new JDatePanelImpl(model);
JDatePickerImpl datePicker = new JDatePickerImpl(datePanel);
add(datePicker);
setSize(300, 200);
setVisible(true);
}
public static void main(String[] args) {
new HelloWorld();
}
}
Why is not importing to class. am i doing it right????