ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil Aggarwal" <n...@JAMMConsulting.com>
Subject How to pass a set of files into args tag?
Date Thu, 18 Sep 2003 16:54:08 GMT
Hello:

I am trying to feed a list of arguments to a Java command.

In my build.xml, I have this:
  <target name="enhancePersistentClasses" depends="processJdoDoclets">
    <path id="enhancerFiles">
      <fileset dir="classes">
        <include name="persistent/*.class"/>
      </fileset> 
      <fileset dir="build">
        <include name="persistent/*.jdo"/>
      </fileset> 
    </path> 
    <java fork="yes" failonerror="yes"
classname="com.sun.jdori.enhancer.Main" classpathref="build-classpath">
      <arg line="-v -f -d build/classes ${enhancerFiles}" />
    </java>
  </target> 

But, when it runs my code, I get this output:

enhancePersistentClasses:
     [java] Enhancer: options:
     [java]     verbose = true
     [java]     quiet = false
     [java]     forceWrite = true
     [java]     noWrite = false
     [java]     sourcePath = null
     [java]     destinationDirectory = build/classes
     [java]     propertiesFileName = null
     [java]     doTiming = false
     [java]     classNames = {
     [java]         ${enhancerFiles}
     [java]     }
     [java]     jdoFileNames = {
     [java]     classFileNames = {
     [java]     }
     [java]     zipFileNames = {
     [java]     }
     [java]     dumpClass = false
     [java]     noAugment = false
     [java]     noAnnotate = false
     [java] JDO ENHANCER: Metadata Warning: no JDO metadata source was
specified
     [java] IO Error while enhancing: ${enhancerFiles}
     [java] aborted with errors.
     [java] java.io.FileNotFoundException: ${enhancerFiles}
     [java]     at
com.sun.jdori.enhancer.Main.openClassInputStream(Unknown Source)
     [java]     at com.sun.jdori.enhancer.Main.enhanceInputFiles(Unknown
Source)
     [java]     at com.sun.jdori.enhancer.Main.process(Unknown Source)
     [java]     at com.sun.jdori.enhancer.Main.main(Unknown Source)


It looks like ant is passing the the ${enhancerFiles} as a literal and
not substituting the path like I expected.

Here is my complete build.xml file in case you need it:
<project name="OjbJdoTest" default="makeRepository"
basedir="c:/Dev/OjbJdoTest">

  <property file="properties/build.properties"/>
  <property file="properties/mysql.profile"/>

  <property name="javalibs" location="c:/JavaLibs" />
  <property name="ojbDir" location="${javalibs}/db-ojb-1.0.rc4" />
  <property name="build-torque" location="${ojbDir}/build-torque.xml" />
  <property name="xdocletDir" location="${javalibs}/xdoclet-1.2b3" />
  <property name="jdoriDir" location="${javalibs}/jdori-1_0" />

  <path id="build-classpath">
    <fileset dir="${ojbDir}/lib">
      <include name="*.jar"/>
     </fileset> 
    <fileset dir="${xdocletDir}/lib">
      <include name="*.jar"/>
     </fileset> 
    <fileset dir="${jdoriDir}/src">
      <include name="*.jar"/>
     </fileset> 
  </path> 

  <target name="clean">
    <delete dir="build"/>
  </target>

  <target name="processOjbDoclets" depends="clean">
    <taskdef name="ojbdoclet"
classname="xdoclet.modules.ojb.OjbDocletTask"
classpathref="build-classpath"/>
    <ojbdoclet destdir="build">
      <fileset dir="src">
        <include name="persistent/*.java"/>
       </fileset> 
      <ojbrepository destinationFile="repository_user.xml"/>
      <torqueschema databaseName="ojbJdoTest"
destinationFile="project_schema.xml"/>
    </ojbdoclet>
  </target> 

  <target name="processJdoDoclets" depends="processOjbDoclets">
    <taskdef name="jdodoclet"
classname="xdoclet.modules.jdo.JdoDocletTask"
classpathref="build-classpath"/>
    <jdodoclet destdir="build">
      <fileset dir="src">
        <include name="persistent/*.java"/>
      </fileset> 
      <jdometadata jdospec="1.0" generation="class"/>
    </jdodoclet>
  </target> 

  <target name="enhancePersistentClasses" depends="processJdoDoclets">
    <path id="enhancerFiles">
      <fileset dir="classes">
        <include name="persistent/*.class"/>
      </fileset> 
      <fileset dir="build">
        <include name="persistent/*.jdo"/>
      </fileset> 
    </path> 
    <java fork="yes" failonerror="yes"
      classname="com.sun.jdori.enhancer.Main"
classpathref="build-classpath">
      <arg line="-v -f -d build/classes ${enhancerFiles}" />
    </java>
  </target> 

  <target name="makeDbSchema" depends="enhancePersistentClasses">
    <ant dir="." antfile="${build-torque}"
target="project-sql-classpath">
      <property name="torque.classpath" value="${build-classpath}"/>
      <property name="schemaDirectory" value="build"/>
      <property name="outputDirectory" value="build"/>
    </ant>
  </target>

  <target name="makeRepository" depends="makeDbSchema">
    <ant dir="." antfile="${build-torque}"
target="project-ojb-repository-classpath">
      <property name="torque.classpath" value="${build-classpath}"/>
      <property name="schemaDirectory" value="build"/>
      <property name="outputDirectory" value="build"/>
    </ant>
  </target>
  
</project>

Thanks,
        Neil

--
Neil Aggarwal, JAMM Consulting, (972)612-6056, www.JAMMConsulting.com
FREE! Valuable info on how your business can reduce operating costs by 
17% or more in 6 months or less! => http://newsletter.JAMMConsulting.com


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


Mime
View raw message