Discussion:
Updating JARS then WAR and at least EAR files using Ant
Philippe Waltregny
2003-08-04 15:05:52 UTC
Permalink
Hello,

Here's my problem.

I've an EAR file which contains a WAR file. This WAR file contains some
JAR files as librairies. I've to update some JAR files, and consequently
both the WAR and the EAR files.

How to do each of these updates using Ant?

Is it possible to do it without having to explode both the EAR and the
WAR files into a directories structure, then to make changes, then to
recreate both the WAR and the EAR files?

Thank you in advance.


Philippe Waltregny
mailto:***@nrb.be
J***@rzf.fin-nrw.de
2003-08-04 15:23:07 UTC
Permalink
Post by Philippe Waltregny
I've an EAR file which contains a WAR file. This WAR file
contains some
JAR files as librairies. I've to update some JAR files, and
consequently
both the WAR and the EAR files.
How to do each of these updates using Ant?
<target name="ear" depends="war,ejb,rar">
<ear destfile="ear/myapp.ear" ...>
<fileset dir="ejbs" include="*.jar"/>
<fileset dir="wars" include="*.war"/>
<fileset dir="rars" include="*.rar"/>
<fileset dir="libs" include="*.jar"/>
</ear>
</target>

<target name="war" depends="jar">
<war destfile="wars/frontend.war" ...>
<!-- all your frontend content -->
</war>
</target>

<target name="rar"/> <!-- similar thing as above -->
<target name="ejb"/>
Post by Philippe Waltregny
Is it possible to do it without having to explode both the EAR and the
WAR files into a directories structure, then to make changes, then to
recreate both the WAR and the EAR files?
<zip> supports nested <zipfileset src=""/> which merges contents of another
zip file into the new one. JAR is the same format, so you can use that.

Well, lets have look into the source, I thought ...

Yep: <jar> extends <zip>. <ear> and <war> extends <jar>.
Therefore a nested <zipfileset> should be possible. Try it out :-)



Jan
Lopez, William
2003-08-04 15:29:24 UTC
Permalink
Philippe:

I have the similar issue...the way I chose to handle it (may not be the best
way but it's the easiest for me :-) is to rebuild the ears, versus unpacking
making changes and repacking- less hassle and the time it takes to rebuild
it is minimal. Also, this way I don't have to worry about forgetting
something. The build [execution] flow is compile all classes, jar them up,
create wars then create ears. We have one "main" build file that calls
others to build their piece of the puzzle. We have also enabled the ability
to build one "component" at a time (jar, war, ear). You could accomplish
this by using the target depends attribute or by using the <ant>, <antcall>
tasks or by using a number of 3rd party/external tasks...it's really up to
your imagination/creativity. This list will also be an invaluable
asset...tons of great ideas and great people.

HTH,
-Will

-----Original Message-----
From: Philippe Waltregny [mailto:***@nrb.be]
Sent: Monday, August 04, 2003 10:06 AM
To: ***@ant.apache.org
Subject: Updating JARS then WAR and at least EAR files using Ant



Hello,

Here's my problem.

I've an EAR file which contains a WAR file. This WAR file contains some JAR
files as librairies. I've to update some JAR files, and consequently both
the WAR and the EAR files.

How to do each of these updates using Ant?

Is it possible to do it without having to explode both the EAR and the WAR
files into a directories structure, then to make changes, then to recreate
both the WAR and the EAR files?

Thank you in advance.


Philippe Waltregny
mailto:***@nrb.be
Antoine Levy-Lambert
2003-08-04 15:28:34 UTC
Permalink
----- Original Message -----
From: "Philippe Waltregny" <***@nrb.be>
Sent: Monday, August 04, 2003 5:05 PM
Subject: Updating JARS then WAR and at least EAR files using Ant
Post by Philippe Waltregny
I've an EAR file which contains a WAR file. This WAR file contains some
JAR files as librairies. I've to update some JAR files, and consequently
both the WAR and the EAR files.
How to do each of these updates using Ant?
Is it possible to do it without having to explode both the EAR and the
WAR files into a directories structure, then to make changes, then to
recreate both the WAR and the EAR files?
Unfortunately, you need to explode the ear and the war, it won't work
otherwise.
Or you need to write your own extensions to the ant tasks.
Cheers,
Antoine

Loading...