You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jay Ashworth <JA...@iLumin.com> on 2000/11/21 21:37:33 UTC

Specifying location in task

Greetings,

I'm trying to implement <war> to replace the process of copying files to a
temp directory and compressing with <jar>.

I'm using the following script snippet:
	<war warfile="${tools.war}"
webxml="${tools.home}/${web.dir}/web.xml" >
		<fileset dir="${tools.home}" includes="*.jsp,*.html" />
		<fileset dir="${tools.home}/${images.dir}" includes="*.gif"
/>
		<fileset dir="${tools.home}/${scripts.dir}" includes="*.js"
/>
		<lib dir="${tools.home}/lib" >
			<exclude name="dhs31.jar" />
			<exclude name="j2ee.jar" />
			<exclude name="commlayer.jar" />
		</lib>
		<classes dir="${build.classes}" />
	</war>

I need the 'images' (2nd fileset...) to be placed in the target war under an
images/ folder (html and jsp files are needed in the root of the archive, so
they're fine, however they reference all images as 'images/xyz.gif').  Is
there any way to do this?  I can't see in the documentation how to force
included files to a particular location in the WAR heirarchy.

Thank you,

Jay Ashworth
Configuration Specialist
iLumin Corporation
801-852-8800
jashworth@ilumin.com

Re: Specifying location in task

Posted by Stefan Bodewig <bo...@apache.org>.
Martin Cooper <ma...@tumbleweed.com> wrote:

> I was going down exactly the same path not long ago, and posted the
> same question here. Unfortunately, the answer was that there is no
> way to do this in the current version of Ant.

Without using a temporary directory or being lucky, yes.

The current CVS sources (Ant 1.3alpha) are a different issue. There is
a nested <prefixedfileset> type that is the same as <fileset> but
allows to specify the place where you want to add it to the war file.

I'd appreciate if you (and anybody else interested in this feature)
replace War.java of Ant 1.2 with the one from current CVS, recompiles
Ant and give it a try. The change really is isolated enough that
replacing that single file should do it.

The documentation for <war> in CVS has been updated as well.

Stefan

Re: Specifying location in task

Posted by Martin Cooper <ma...@tumbleweed.com>.
I was going down exactly the same path not long ago, and posted the same
question here. Unfortunately, the answer was that there is no way to do this
in the current version of Ant. For now, I've had to abandon using the <war>
task and go back to using <jar> instead, in conjunction with a staging area.
Pity - it seems to negate the usefulness of <war> somewhat.

--
Martin Cooper
Tumbleweed Communications

----- Original Message -----
From: "Jay Ashworth" <JA...@iLumin.com>
To: <an...@jakarta.apache.org>
Sent: Tuesday, November 21, 2000 12:37 PM
Subject: Specifying location in <war> task


> Greetings,
>
> I'm trying to implement <war> to replace the process of copying files to a
> temp directory and compressing with <jar>.
>
> I'm using the following script snippet:
> <war warfile="${tools.war}"
> webxml="${tools.home}/${web.dir}/web.xml" >
> <fileset dir="${tools.home}" includes="*.jsp,*.html" />
> <fileset dir="${tools.home}/${images.dir}" includes="*.gif"
> />
> <fileset dir="${tools.home}/${scripts.dir}" includes="*.js"
> />
> <lib dir="${tools.home}/lib" >
> <exclude name="dhs31.jar" />
> <exclude name="j2ee.jar" />
> <exclude name="commlayer.jar" />
> </lib>
> <classes dir="${build.classes}" />
> </war>
>
> I need the 'images' (2nd fileset...) to be placed in the target war under
an
> images/ folder (html and jsp files are needed in the root of the archive,
so
> they're fine, however they reference all images as 'images/xyz.gif').  Is
> there any way to do this?  I can't see in the documentation how to force
> included files to a particular location in the WAR heirarchy.
>
> Thank you,
>
> Jay Ashworth
> Configuration Specialist
> iLumin Corporation
> 801-852-8800
> jashworth@ilumin.com



RE: Specifying location in task

Posted by Wes Moulder <wm...@axyssolutions.com>.
My suggestion would be something like this:

	<war warfile="${tools.war}"
	     webxml="${tools.home}/${web.dir}/web.xml" >
 		<fileset dir="${tools.home}" includes="*.jsp,*.html,images/*.gif,
				  ${scripts.dir}/*.js" />
 		<lib dir="${tools.home}/lib" >
 			<exclude name="dhs31.jar" />
 			<exclude name="j2ee.jar" />
 			<exclude name="commlayer.jar" />
 		</lib>
 		<classes dir="${build.classes}" />
 	</war>
Where you have one single fileset.  This should include images in the
images/ directory, and scripts in the ${scripts.dir} directory.
--Wes

> -----Original Message-----
> From: Jay Ashworth [mailto:JAshworth@iLumin.com]
> Sent: Tuesday, November 21, 2000 2:38 PM
> To: ant-user@jakarta.apache.org
> Subject: Specifying location in <war> task
>
>
> Greetings,
>
> I'm trying to implement <war> to replace the process of
> copying files to a
> temp directory and compressing with <jar>.
>
> I'm using the following script snippet:
> 	<war warfile="${tools.war}"
> webxml="${tools.home}/${web.dir}/web.xml" >
> 		<fileset dir="${tools.home}" includes="*.jsp,*.html" />
> 		<fileset dir="${tools.home}/${images.dir}"
> includes="*.gif"
> />
> 		<fileset dir="${tools.home}/${scripts.dir}"
> includes="*.js"
> />
> 		<lib dir="${tools.home}/lib" >
> 			<exclude name="dhs31.jar" />
> 			<exclude name="j2ee.jar" />
> 			<exclude name="commlayer.jar" />
> 		</lib>
> 		<classes dir="${build.classes}" />
> 	</war>
>
> I need the 'images' (2nd fileset...) to be placed in the
> target war under an
> images/ folder (html and jsp files are needed in the root of
> the archive, so
> they're fine, however they reference all images as
> 'images/xyz.gif').  Is
> there any way to do this?  I can't see in the documentation
> how to force
> included files to a particular location in the WAR heirarchy.
>
> Thank you,
>
> Jay Ashworth
> Configuration Specialist
> iLumin Corporation
> 801-852-8800
> jashworth@ilumin.com
>