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

  • Home
  • SEARCH
  • 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 921543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:53:18+00:00 2026-05-15T18:53:18+00:00

Update : I am using Ant 1.8.1 on Windows XP. I am trying to

  • 0

Update: I am using Ant 1.8.1 on Windows XP.

I am trying to write an Ant master build file for multiple projects. I can successfully create a jar for each project, and I want to package all of these jars into a single tar.gz file. Each jar file is located within the bin subdirectory of its respective project, but this path could be changed in the future. I’ve tried something like this:

<tar destfile="foo.tar.gz" compression="gzip" >
   <tarfileset dir=".">
      <include name="**/*.jar" />
   </tarfileset>
</tar>

…which kind of works. The only problem is that it maintains the directory structure within the jar. I want a flat file. So instead of:

foo.tar.gz
   project1
      bin
         project1.jar
   project2
      bin
         project2.jar
etc...

I need:

foo.tar.gz
   project1.jar
   project2.jar

I attempted to use Ant’s copy task to copy these jar files to a temporary directory and then tar them from there. However, the copy operation replicates paths within the target directory. So, same problem.

  • 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-15T18:53:18+00:00Added an answer on May 15, 2026 at 6:53 pm

    I think you’re almost there, having assembled a flattened directory of your files. What remains is to get rid of the tarfileset element, which is there specifically for preserving/inserting structure. I think tar and zip tasks work fine with embedded fileset elements.

    The documentation bears me out on this – up until 1.7 fileset was the embedded resource element that could be used in place of tarfileset.

    Come to think of it, I think that once you switch to fileset, you may no longer need to temp-copy your files for flattening.


    EDIT:

    I just built and ran this buildfile:

    <project name="tartest" default="teer">
       <target name="teer">
          <tar destfile="tartest.tar">
         <fileset dir="../Downloads" includes="*.ico *.gif"/>
          </tar>
       </target>
    </project>
    

    and there was no trace of the original directory in the archive:

    -rw-r--r-- 0/0            3487 2009-12-28 20:04 actor075_thumb.gif
    -rw-r--r-- 0/0            1456 2010-06-16 10:57 bea-logo.gif
    -rw-r--r-- 0/0           23800 2010-06-16 09:22 ejb1.gif
    -rw-r--r-- 0/0            1406 2010-05-15 10:40 favicon-beta.ico
    -rw-r--r-- 0/0            1406 2010-05-15 10:25 favicon-clown.ico
    -rw-r--r-- 0/0            1406 2008-12-06 01:08 favicon.ico
    

    Also, tar -xvf tartest.tar dumped the tarred files in my current directory.

    So… what are you doing differently that is causing different results for you?


    EDIT 2:

    More insight gained from re-reading your question. I’d completely sidestepped the problem of source paths generated by **/* wildcards.

    Since you’re already considering copying those jar files to a temporary directory, all that’s missing is to use the flatten attribute on the copy task. That should fix you up.

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

Sidebar

Related Questions

I'm trying to use org.sqlite.JDBC to create and update a sqlite database in ant.
I'm using Ant to build some Java projects. In some, I've got a lib/
I'm using ant.bat (in Ant 1.7.1) to build the all target in a build.xml
I am trying to write an Ant <scriptfilter...> to change occurrences of the string
I need to generate an apk file using an Ant script, but I'm having
Do you know any documentation about the rules of using update sites? I have
Is there any way to force an update of software using RunOnce, without having
I want to recreate the the update panel postback without using an update panel
Update: We are still using XP at work and I got my solution working,
I'm using an Ajax update panel and have recently added ASP.NET tracing code to

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.