ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: Correct configuration for reading a list into a Java class
Date Sat, 01 Dec 2012 16:58:28 GMT

Good Afternoon Lewis <fileset dir="${gora.avsc.dir}" my understanding of fileset dir attribute
is that dir represents a single root folderhttp://ant.apache.org/manual/Types/fileset.html

if your goal is to aggregate files from 2 folders from different rootsyou *may* wish to consider
implementing a project based <selector> http://ant.apache.org/manual/Types/selectors.html#selectcontainers
cheers,
Martin
______________________________________________ 
Don't use a cannon to kill a mosquito.... Confucius > Date: Sat, 1 Dec 2012 16:25:54 +0000
> Subject: Correct configuration for reading a list into a Java class
> From: lewis.mcgibbney@gmail.com
> To: user@ant.apache.org
> 
> Hi All,
> 
> I've done a fiar bit of digging on this one on user@ archives and
> there have been various threads on the topic. I understand that the
> solution to reading in multiple files an executing them with the java
> element is a custom solution. The problem is pretty simple. I have a
> directory of avro schemas which I would like to pass to a GoraCompiler
> class to be compiled.
> 
> So far I've got
> 
>  <!-- ====================================================== -->
>  <!-- Generate the Java files from the GORA schemas          -->
>  <!-- Will call this automatically later                     -->
>  <!-- ====================================================== -->
>  <!-- map for the gora .avsc files contained in ./src/gora/
>       so they can be passed as a list to the GoraCompiler
>       via the generate-gora-src target                -->
>  <fileset dir="${gora.avsc.dir}" id="gora.avsc.files">
>   <include name="*.avsc"/>
>  </fileset>
>  <pathconvert property="goraavscfiles" refid="gora.avsc.files">
>   <map from="${goraavscdir}" to=""/>
>  </pathconvert>
> 
>  <target name="generate-gora-src"
>   description="> generate the Java files from the Gora schema(s) in
> src/gora/*.avsc">
>   <java classname="org.apache.gora.compiler.GoraCompiler" fork="true">
>    <classpath refid="classpath"/>
>    <arg value="${goraavscfiles}"/>
>    <arg value="${src.dir}"/>
>   </java>
>  </target>
> 
> When I execute I get
> 
> generate-gora-src:
>      [java] 12/12/01 16:22:09 INFO compiler.GoraCompiler: Compiling
> schema file: /home/lewismc/ASF/2.x/src/gora/host.avsc:/home/lewismc/ASF/2.x/src/gora/webpage.avsc
> to: ./src/java
>      [java] Exception in thread "main" java.io.FileNotFoundException:
> /home/lewismc/ASF/2.x/src/gora/host.avsc:/home/lewismc/ASF/2.x/src/gora/webpage.avsc
> (No such file or directory)
>      [java] 	at java.io.FileInputStream.open(Native Method)
>      [java] 	at java.io.FileInputStream.<init>(FileInputStream.java:120)
>      [java] 	at
> org.codehaus.jackson.JsonFactory.createJsonParser(JsonFactory.java:325)
>      [java] 	at org.apache.avro.Schema.parse(Schema.java:794)
>      [java] 	at
> org.apache.gora.compiler.GoraCompiler.compileSchema(GoraCompiler.java:87)
>      [java] 	at
> org.apache.gora.compiler.GoraCompiler.main(GoraCompiler.java:509)
>      [java] Java Result: 1
> 
> BUILD SUCCESSFUL
> Total time: 6 seconds
> 
> If someone could please help me to understand how to separate the
> files into the required File [] list then that would be great. I
> should make it clear that I've discovered pathconvert's pathsep
> attribute but it still seems to be a string being passed as oppose to
> a separated list of files.
> I should also note that making the target accept a single explicit
> file works perfectly, so I know my configuration is in the way I'm
> constructing the mappings.
> 
> Thanks very much in advance
> 
> Lewis
> 
> 
> 
> 
> -- 
> Lewis
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message