[Anthill] Anthill ${version} property

Jefferson K. French jeff at mdbconsulting.com
Thu Apr 29 08:15:12 CDT 2004


Don't know offhand how you can do it with Ant tags, but you could
write a simple task to do it for you. Something like:

  public class JustBuildNum extends Task {
    private String myVersion;
    public void setVersion(String version) {
      myVersion = version;
    }
    public void execute() {
      int dot = myVersion.lastIndexOf(".");
      String buildnum = myVersion.substring(dot+1);
      getProject().setNewProperty("buildnum", buildnum);
    }
  }

Which you'd then define and invoke like:

  <taskdef name="justbuildnum"
           classname="com.mycompany.ant.JustBuildNumTask"
           classpathref="task.classpath"/>
  <justbuildnum version="${version}"/>

You'd end up with a property "buildnum" with just the part after the
last period. You'll need to make sure "task.classpath" is set
appropriately. You may want to add some error checking, like making
sure there really are characters after the last period.

  Jeff

On Thu, 29 Apr 2004, at 11:57:31 [GMT +0100] rhonda.brown at lynx.co.uk
wrote:

> Hi
   

> I have read that the ${version} property is made up of <prefix> <buildNo> <postfix>.  Is there a way of just extracting the <buildNo> from this property to tag certain source files?
   

> I have used the property ${version} to tag the files as seen below in the build file:
   

> <cvs command="tag ${build.type}_release_${version}_repository_${build.number} ${repository.home}" cvsroot="${cvs.connection}"/>
   

> The build is successful, except it is not tagging any of the files as expected.  I have checked the build log and found the following message:
   

> cvstag:
>      [echo] build.number=120
>       [cvs] cvs [tag aborted]: tag `Ver_release_1.0.4187_resources_120' must not contain the characters `$,.:;@'
   

   

> Is there any way to get the last 4 digits from the version number as it does not allow any form of punctuation to separate the numbers?
   

> Thanks in advance
   

> Rhonda
   

   



> This message is intended only for the use of the person(s) ("The intended
> Recipient(s)") to whom it is addressed.  It may contain information which
> is privileged and confidential within the meaning of applicable law.  If
> you are not the intended recipient, please contact the sender as soon as
> possible.  The views expressed in this communication are not necessarily
> those held by LYNX Express Limited.
> _______________________________________________
> Anthill mailing list
> Anthill at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill

-- 
MDB Consulting, LLC
mailto:jeff at mdbconsulting.com





More information about the Anthill mailing list