Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6358015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:17:09+00:00 2026-05-24T23:17:09+00:00

I wrote a build script in ant. The source code of my project is

  • 0

I wrote a build script in ant. The source code of my project is versioned in svn.

As a part of my project I had to write a java class, that contains information from subversion. In general, the build script works fine. All needed information will be gathered, except one. This is the name of the author who commited the last change in the reporsitory. Though I read the manual, I still come up with any ideas.

My question to you is: does exist a way to get also this detail with an ant script?

Thanks

EDIT:

<target name="version" description="set version number">
    <echo message="Setting version information ..." />
    <copy file="build/Version.java.template"
        tofile="./cq/apps/src/de/anna/util/Version.java" /> 
    <tstamp>
        <format property="TODAY_De"
         pattern="yyyy/MM/dd HH:mm:ss"
         locale="de,De"/>
    </tstamp>
    <replace file="./cq/apps/src/de/anna/util/Version.java">
        <replacefilter token="@APPNAME@" value="${app.name}" />
        <replacefilter token="@BUILDVERSION@" value="${build.number}" />
        <replacefilter token="@BUILDDATE@" value="${TODAY_De}" />
    </replace>
    <exec executable="${version.tool}" spawn="false" dir=".">
        <arg line=". cq/apps/src/de/anna/Util/Version.java cq/apps/src/de/anna/Util/Version.java" />
    </exec>
</target>

What I want to add in file Version.java, who is the author of last commit and the id of the change entry. (I think/thought $Author$ and $Id$ were the variables)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:17:10+00:00Added an answer on May 24, 2026 at 11:17 pm

    Forget about SubWCRev and think about Subversion. That’s what your working with.

    In Subversion, you need to set a property called svn:keywords, and set that value to the keywords you want to use. This is explained in the on line Subversion manual in Keyword Substitution.

    By using the svn:keywords property, you have the Subversion repository handle the variable names for you. For example, you have a file called information.txt that looks like this:

    The last person to check in the file is $Author$ and the last version was $Version$.
    

    Checking that file into Subversion doesn’t change $Author$ or $Revision$.

    Now, you set the property svn:keywords on the information.txt file:

    $ svn propset svn:keywords "Author Date" information.txt
    $ svn commit -m"Setting svn:keywords to set the information in information.txt"
    

    You can do this through TortoiseSVN too via the Context Menu TortoiseSVN–>Properties

    Now, when you look at the file, the fields changed:

    $ cat information.txt
    The last person to check in the file is $Author:David$ and the last version was $Revision:123$.
    

    Not what you want? Another thing you can do is simply execute svn info and get the properties you want in XML format. Then you can use the <xmlProperties> task to read them in as properties:

    <project>
        <property name="target.dir" value="${basedir}/target"/>
    
        <mkdir dir="${target.dir}"/>
        <exec executable="svn"
            outputProperty="svn.info">
            <arg line="info --xml"/>
        </exec>
        <echo message="${svn.info}"
            file="${target.dir}/info.txt"/>
        <xmlproperty file="${target.dir}/info.txt"
            keeproot="no"
            prefix="svn"/>
        <echo message="Author = &quot;${svn.entry.commit.author}&quot;"/>
        <echo message="Date = &quot;${svn.entry.commit.date}&quot;"/>
        <echo message="Revision = &quot;${svn.entry(revision)}&quot;"/>
    </project>
    

    I use the <exec> task to grab the Subversion information and put it in the property ${svn.info}. I then use the <echo> task to output it to the ${target.dir}/info.txt file. After that, I can read the file via the <xmlproperty> task and pull out the information below.

    From there, I now have all the Subversion revision and repository information stored in various properties.

    If you know resource collections, you can actually do this without first writing the file to ${target}/info.txt

    <project>
        <exec executable="svn"
            outputProperty="svn.info">
            <arg line="info --xml"/>
        </exec>
    
        <xmlproperty keeproot="no"
            prefix="svn">
            <propertyresource name="svn.info"/>
        </xmlproperty>
    
        <echo message="Author = &quot;${svn.entry.commit.author}&quot;"/>
        <echo message="Date = &quot;${svn.entry.commit.date}&quot;"/>
        <echo message="Revision = &quot;${svn.entry(revision)}&quot;"/>
    </project>
    

    Hope this is what you’re looking for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a script that uses xcodebuild to generate an AdHoc build of an
I am trying to write an ant script which builds our project and will
I'm trying to write an ant build script to build my group's flex app,
I am attempting to write a build script for our source tree. This tree
I write ant build script. I need to create a symlink and I found
I have an ant script that compile my program, build the jar and then
I have a problem. I wrote example code and I want to build it
i write a simple webservice code in asp.net when i build the service and
I have an object that can build itself from an XML string, and write
Can .NET (managed code) read and write to CouchDB? I would like to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.