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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:20:04+00:00 2026-06-12T17:20:04+00:00

I have a client and a server that I’m building with Ant. The client

  • 0

I have a client and a server that I’m building with Ant. The client relies on the server being built first before it can build. I have all of the required libraries except the server ear file bundled in the client.

I created 3 ant files build.xml, build-client.xml, and build-server.xml. (Click on any of the file names to see them) The files build-client.xml and build-server.xml are included in build.xml so that it can run targets from them.

The problem I’m having is that the basedir variable changes from build file to build file. So if I run targets in build-client.xml from build.xml the basedir variable is relative to build.xml.

How do I change the basedir variable multiple times within an Ant script?

Also, looking at these build files, do you see a better way of doing what I’m trying to do? Right now I’m thinking that I have to have both the client war and server ear in the same location before I can make the final bundled ear. My idea about this may be flawed though because these scripts seem unnecessarily complex.

  • 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-12T17:20:04+00:00Added an answer on June 12, 2026 at 5:20 pm

    The ant documentation for <import> task gives you information about how to accomplish this.

    Resolving files against the imported file

    Suppose your main build file called importing.xml imports a build file imported.xml, located anywhere on the file system, and imported.xml reads a set of properties from imported.properties:

    <!-- importing.xml -->
    <project name="importing" basedir="." default="...">
      <import file="${path_to_imported}/imported.xml"/>
    </project>
    
    <!-- imported.xml -->
    <project name="imported" basedir="." default="...">
      <property file="imported.properties"/>
    </project>
    

    This snippet however will resolve imported.properties against the basedir of importing.xml, because the basedir of imported.xml is ignored by Ant. The right way to use imported.properties is:

    <!-- imported.xml -->
    <project name="imported" basedir="." default="...">
      <dirname property="imported.basedir" file="${ant.file.imported}"/>
      <property file="${imported.basedir}/imported.properties"/>
    </project>
    

    As explained above ${ant.file.imported} stores the path of the build script, that defines the project called imported, (in short it stores the path to imported.xml) and <dirname> takes its directory. This technique also allows imported.xml to be used as a standalone file (without being imported in other project).

    Basically, you can’t really use the ${basedir} variable, nor the basedir="./../GrahamsProjClient" attribute in your project tag, but instead you can construct it:

    <!-- build-client.xml -->
    <project name="GPClient" default="dist" >
    
      <dirname property="client.root.dir" file="${ant.file.GPClient}"/>
      <property name="real.basedir" value="${client.root.dir}/../GrahamsProjClient"/>
    
      <!-- Then from then on, replace ${basedir} with ${real.basedir} -->
      ...
    </project>
    

    You can do the same for the build-server.xml, the only thing to watch for is that the project name is featured in the ${ant.file.[project name]} file attribute for <dirname />.

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

Sidebar

Related Questions

I have our first NodeJS server that's being deployed to a client server along
I have an application that runs on a client's server built on a SQL
I'm building 2 programs (client/server) that communicate through FIFOs. Both programs have threads. When
I have a client-server application that utilises MSMQ and NServiceBus for messaging. During some
We have a Flex client and a server that is using the Spring/Blazeds project.
I have a client and a server app on Android (that uses ZeroC -
I have a game server that spawns a thread for each client with forkIO.
We have a number of different old school client-server C# WinForm client-side apps that
I have Android client app that communicates with server using Socket . On my
We have a client application that needs to send messages to a server for

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.