-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: wildcard multiple arg values to java task?
PostPosted: Thu Oct 28, 2004 8:58 pm 
Beginner
Beginner

Joined: Fri Oct 15, 2004 2:54 pm
Posts: 33
Location: Austin, TX
This is really just an ant question, but I can't find a way to do this one really useful thing. I'm betting someone else has seen the same need and hopefully solved the problem.

Here goes:
How do you wildcard arguments to the java task? I keep seeing things like this:

Code:
<java  classname="org.hibernate.auction.bench.client.BenchmarkSql" fork="true" dir="${classes.dir}">
            <classpath refid="lib.class.path"/>
            <classpath location="${classes.dir}"/>

            <arg value="${mapping.home}/foo.hbm.xml" />
            <arg value="${mapping.home}/bar.hbm.xml" />
        </java>


and what I really want to do is something like this:

Code:
<java  classname="org.hibernate.auction.bench.client.BenchmarkSql" fork="true" dir="${classes.dir}">
            <classpath refid="lib.class.path"/>
            <classpath location="${classes.dir}"/>

            <arg value="${mapping.home}/**/*.hbm.xml" />
        </java>


That way I could generate new mapping files and just let the ant task find and build based on them. I wouldn't have to shadow the new files in the ant task. The java task won't take filesets, and I can't get a refid in there either. Ant keeps failing at that point. Has anyone figured out how to do this?

_________________
--Pierce Krouse


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 29, 2004 1:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Look at <Pathconvert> and use a space as the dir separator.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: the answer
PostPosted: Fri Oct 29, 2004 4:09 pm 
Beginner
Beginner

Joined: Fri Oct 15, 2004 2:54 pm
Posts: 33
Location: Austin, TX
Thanks Max -- that was exactly the thing. For those that are interested, here is the solution:

set up these first:

Code:
<path id="mappingfiles.path">
      <!-- following pathelement didn't work, but fileset did
      <pathelement location="${mapping.home}/**/*.hbm.xml" />
      -->
      <fileset dir="${mapping.home}">
         <include name="**/*.hbm.xml" />
      </fileset>
   </path>

   <pathconvert pathsep=" " property="mappingfiles.list" refid="mappingfiles.path">
      <!-- 1.6.2 manual says a map is required, but this works
      <map from=" " to=" " />
      -->
   </pathconvert>


then use in schemaExport like this:

Code:
<target name="schemaExport">
      <java classname="net.sf.hibernate.tool.hbm2ddl.SchemaExport" fork="true">
         <!--
         <arg value="${mapping.home}/event.hbm.xml" />
         -->
         <arg value="mappingfiles.list" />
         <classpath refid="lib.class.path" />
      </java>
   </target>


That's it.

_________________
--Pierce Krouse


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.