2009-02-20

Print Classpath in Ant Build File []

Moved to the page http://3rdstage.wikia.com/wiki/On_Ant in my wiki as of 6th Aug. 2012.
Sometimes, it can be convenient to print out classpath to console to confirm it is correctly setup in Ant build file. For this, you can use the expression ${toString:pathreference} like the following example
<?xml version="1.0" encoding="UTF-8"?>
<project name="shop1-hibernate-export" default="echo-env" basedir="."
 xmlns:artifact="antlib:org.apache.maven.artifact.ant">

 ...

 <!-- Get Maven Dependency -->
 <artifact:pom id="project.pom" file="${project.home}/pom.xml"/>
 <artifact:dependencies pomRefId="project.pom" pathId="dependency.classpath"/>
 
 <!-- Ant4Eclipse Tasks Definitions -->
 <taskdef resource="net/sf/ant4eclipse/antlib.xml" /> 
 <getEclipseClasspath pathId="eclipse.classpath" project="../../../../../.."/>

 <path id="project.classpath">
  <path refid="dependency.classpath"/>
  <path refid="eclipse.classpath"/>
 </path>

 <target name="echo-env">
  <echoproperties/>
  <echo>${toString:project.classpath}</echo>
 </target>

 <target name="generate-ddl">

 </target>

</project>

0 comments:

Post a Comment