You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Hill, Richard" <ri...@attws.com> on 2004/07/20 21:32:30 UTC

How to get subproject file name from within the subproject?

ANT: 1.5.4
JDK: 1.4.2_05
 
I have a project that calls a subproject. For example:
 
<project name="TestProject" default="test">
    <target name="test">
      <ant antfile="TestFile.xml"/>
    </target>
</project>
 
I would like to get the name of the subproject file (i.e. TestFile.xml)
from a target within the subproject itself. I've accomplished this
before using the optional 'script' task using something like: 
 
<target name="setupDirectories"> 
  <script language="javascript">
      <![CDATA[
          importClass(java.io.File);
          file = new java.io.File(
MyTestFileProjectName.getProperty("ant.file") );
 
...but I am have heck of a time with the subproject finding the bsf.jar
and js.jar due to resource conflicts. 
 
Is there another, easier way to get the subproject file name from within
the subproject itself. 
 
Thanks,
RH