ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hill, Richard" <richard.h...@attws.com>
Subject RE: How to get subproject file name from within the subproject?
Date Tue, 20 Jul 2004 21:39:20 GMT
The following gets me the full path to the subproject file.

    <property name="FullTestFilePath" value="${ant.file}"/> 

For example, if my path to the test file is
c:\project\suite\TestFile.xml, I would like to extract only the
"TestFile" part of the path (the file name without the extension) and
set it into a property. Currently, are there any Ant tasks would allow
me to parse this information to a property?

ANT: 1.5.4
JDK: 1.4.2_05

Thanks again,
RH

-----Original Message-----
From: Hill, Richard [mailto:richard.hill@attws.com] 
Sent: Tuesday, July 20, 2004 12:33 PM
To: user@ant.apache.org
Subject: 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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message