• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to add a war file to a tar through build file

 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have built an application and I wanted my tar file to contain my application.war and few more directories in the same heirarachy

I am able to create my war file correctly with the help of war tag in the build file and a tar file as well. But I am not able to get those war files and the other rdirectories in my tar file..

I am confused using the fileset or I tried with a move tag.

Can anyone advise how to do this
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the tar file exist or are you trying to create it? If the former, I think you have to untar it first, add the file to the directory and then retar.

The tar task and untar tasks are helpful with this.

Can you post some code using the tar task so we can give more concrete pointers?
 
rahulJ james
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created a war file with my full application excluding few directories and I wanted to move this to a tar along with 2 more directories..

<war destfile="../${name.war}" webxml="WEB-INF/web.xml">
<fileset dir="${basedir}">
<exclude name="${src}/**" />
<exclude name=".**" />
<exclude name="*.**" />
</fileset>

</war>

By this I am able to war. For tar, I just wanted to know how to include this war and other directories while tarring..
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried the 2 tasks that Jeanne mentioned above?
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by rahulJ james:
I have created a war file with my full application excluding few directories and I wanted to move this to a tar along with 2 more directories..

<war destfile="../${name.war}" webxml="WEB-INF/web.xml">
<fileset dir="${basedir}">
<exclude name="${src}/**" />
<exclude name=".**" />
<exclude name="*.**" />
</fileset>

</war>

By this I am able to war. For tar, I just wanted to know how to include this war and other directories while tarring..



Hello Rahul,

Let's assume the directory structure of "war.basedir" is as follows:-

war.basedir--
|__${name.war} ---- (The war file which got created)
|
|__dir1
|
|__dir2
|
|__docs

and the directory "root.basedir" is the parent directory of "war.basedir"

Now, assume you want to tar all the contents of "war.basedir" at root.basedir but ignoring docs folder which is sub directory of "war.basedir"

The code for the same would be like this:-



For other options of tar task
[ November 19, 2008: Message edited by: Manish Doomra ]
 
rahulJ james
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah I could tar the file. Thanks..

How will I be able to read a property file and replace the values in the build.xml file before it is kciked off..

I mean I have 3 property files(test, dev and prod), based on reading this file I have to change few values in build.xml file..

How do I do this?
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A simple way is to pass a -D parameter into your Ant script, e.g. -Denv=dev for development and then use that to choose which properties file to load.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic