You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Eric Wood <EW...@llbean.com> on 2007/11/12 17:17:02 UTC

copy contents of a directory based on a dirset

I have a dirset that represents the contents of a j2ee application:

EAR
+ -- WAR

This is an application that only contains a WAR, but there may be other
components such as utility JARs, MDBs, etc.

The EAR's build.xml has the following dirset:

<dirset dir=".." id="ear.components" >
    <include name="WAR"/>
</dirset>

I want to use this dirset to package the war file into my EAR.  The
WAR's build.xml puts the WAR file into a subdirectory called "dist.

EAR
+ -- WAR
       +--dist
            +-- x.war

Is there a way to use this dirset to say copy the contents of the
directory's dist folder to the EAR for packaging?

Any help would be greatly appreciated.

Re: copy contents of a directory based on a dirset

Posted by Rob Wilson <ne...@gmail.com>.
I have used the ant 'war' element and believe there is an equivallent
'ear' element too - it might help you?  I then use the fileset with an
include (see below)...


	<target name="War" depends="Initialize, Compile">
		<echo message="Generating War file..."/>
		<war destfile="${warfile}" webxml="${web-inf.dir}/web.xml">
			<classes dir="${src}" includes="**/*.xml" />
			<classes dir="${deploy}" includes="**/*.class" />
			<fileset dir="${webcontent.dir}">
				<include name="**/*"/>
			</fileset>
			<!-- Note that only the flat directory structure is copied, I
			     think this is a JSP spec, but also this means any files
			     we dont want copied can be put in the sub-directory
			     called 'build-time-only'. -->
			<lib dir="${web-lib.dir}" includes="*.jar"
				excludes="jsp-api.jar,servlet-api.jar"
			/>
			<lib dir="${common-lib}" includes="*.jar" />
		</war>
	</target>

On Nov 12, 2007 4:17 PM, Eric Wood <EW...@llbean.com> wrote:
> I have a dirset that represents the contents of a j2ee application:
>
> EAR
> + -- WAR
>
> This is an application that only contains a WAR, but there may be other
> components such as utility JARs, MDBs, etc.
>
> The EAR's build.xml has the following dirset:
>
> <dirset dir=".." id="ear.components" >
>    <include name="WAR"/>
> </dirset>
>
> I want to use this dirset to package the war file into my EAR.  The
> WAR's build.xml puts the WAR file into a subdirectory called "dist.
>
> EAR
> + -- WAR
>       +--dist
>            +-- x.war
>
> Is there a way to use this dirset to say copy the contents of the
> directory's dist folder to the EAR for packaging?
>
> Any help would be greatly appreciated.
>



-- 
Regards,
Rob Wilson

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org