ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "RADEMAKERS Tanguy" <>
Subject RE: Extracting application version from Java file
Date Tue, 20 Sep 2005 18:25:38 GMT
Hello List,

I was going to reply to Nicolas that, whilst i agree with the other two
replies (you should pass the version in somehow and not read it from the
java source file), you *can* achieve what he is trying to do using the
<loadproperties> task with a nested <classconstants> filterchain. But i
can't seem to get it to work. I've posted my example below, can anybody
see what i'm doing wrong?
public class mytest
   public static final String VERSION = "XX.YY.ZZ";

   public static void main(String[] args)
      System.out.println("Hello, World!");

<project name="test" default="main" basedir=".">

    <target name="main">

        <javac srcdir="." 
        <loadproperties srcfile="mytest.class">




i get a "Unable to load file:" message. I've tried
putting a static properties file and loading that - no probs. I've tried
copying the class to a properties file by using the classconstants
filterchain... didn't work (same error). 


>-----Original Message-----
>From: Nicolas Vervelle [] 
>Sent: Tuesday, September 20, 2005 6:23 PM
>Subject: Extracting application version from Java file
>In one of my Java source file, I have a line like this:
>public final static String version = "XX.YY.ZZ";
>I'd like to extract the XX.YY.ZZ from the Ant build to name the 
>resulting jar file with it : Jmol.XX.YY.ZZ.jar
>Can someone help me with how to extract the string from the file ?
>Thanks in advance,
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message