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 9231411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:03:39+00:00 2026-06-18T06:03:39+00:00

I am using the following bunch of softwares: Ant 1.7.1 Eclipse Helios Java 1.6

  • 0

I am using the following bunch of softwares:

  1. Ant 1.7.1
  2. Eclipse Helios
  3. Java 1.6
  4. Apache thrift 0.8.0

I am using Thrift to generate java source code in Ant using the following code block:

<exec executable="thrift-0.8.0.exe" osfamily="windows">
    <arg value="-out" />
    <arg value="java/src" />
    <arg value="--gen" />
    <arg value="java" />
    <arg file="Sample.thrift" />
</exec>

So, now I want to add the generated src folder automatically to the classpath of the project in Eclipse using Ant so that it is shown as a source folder when I open the project in Eclipse.

NOTE: I understand that the classpath for a project is present in the .classpath file and adding a classpathentry to it would solve my issue. But I want Eclipse to do that instead of me doing it in the .classpath file manually.

Further, I also had a look at the Ant-Eclipse project and found an Ant task to create a new Eclipse Java project and display its src folder as a source folder. But I don’t want a dependency on an external library.

<project name="test" default="eclipse" basedir=".">
    <target name="eclipse">
        <taskdef name="eclipse" classname="prantl.ant.eclipse.EclipseTask" />
        <eclipse>
            <project />
            <classpath>
                <source path="src" />
                <output path="bin" />
            </classpath>
        </eclipse>
    </target>
</project>

Is there a way to do this in the already existing Ant library in Eclipse?

Thanks a lot!

  • 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-06-18T06:03:40+00:00Added an answer on June 18, 2026 at 6:03 am

    If you really don’t want to depend on anything external then you could consider using an XSLT stylesheet to edit the .classpath file (which is XML).

    add-dir.xsl

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:param name="pathToAdd" />
    
      <xsl:strip-space elements="*" />
      <xsl:output method="xml" indent="yes" />
    
      <xsl:template match="@* | node()">
        <xsl:copy>
          <xsl:apply-templates select="@* | node()" />
        </xsl:copy>
      </xsl:template>
    
      <xsl:template match="classpath">
        <xsl:copy>
          <xsl:apply-templates select="@* | node()" />
          <!-- don't add a 2nd copy of the classpathentry if one already exists -->
          <xsl:if test="not(classpathentry[@kind = 'src'][@path = $pathToAdd])">
            <classpathentry kind="src" path="{$pathToAdd}" />
          </xsl:if>
        </xsl:copy>
      </xsl:template>
    </xsl:stylesheet>
    

    build.xml

    <xslt in=".classpath" out=".classpath.edited" style="add-dir.xsl">
      <param name="pathToAdd" expression="java/src" />
    </xslt>
    <move file=".classpath.edited" tofile=".classpath" overwrite="yes" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following bunch of code trying to update a field using 2
Im using the following code to get a bunch of information about employees from
I'm using the following code to set a bunch of DataGridViewRow elements to be
We are using the following Apache Commons Net FTP code to connect to an
Using the following code to open a bunch of links in column A of
Using following code I try to get updated list of checkbuttons' corresponding text values,
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am creating date using following code try { newdatetime = new DateTime(2012, 2,
I am using following code for showing a MessageBox with ok and cancel button.
I am using following code to show a spinning wheel: $(#loading) .hide() .ajaxStart(function(){ $(this).show();

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.