c4il
c4il

Reputation: 965

Deploying context.xml to webapps/[webappname]/META-INF

I'm using Tomcat 6.0.26 and am writing build.xml to deploy war file. The following code is what I have right now, and I need to pack context.xml under /META-INF/ as I wish to have this configuration like #2. I have searched the attribute for the war command, but I couldn't find anything that works like webxml for WEB-INF/web.xml.

So my questions are,

1) Is there an war attribute to place the context.xml under META-INF ?

2) If there isn't such an attribute, what would be the best way to place the context.xml under META-INF for each webapp?

<target name="packwar">
   <war destfile="${appname}.war" webxml="web.xml">
        <lib file="${bin}/myapp.jar"/>
   </war>
</target>

Thank you in advance.

Upvotes: 3

Views: 3475

Answers (1)

martin clayton
martin clayton

Reputation: 78205

You should be able to use the metainf nested element of the 'war' task:

The nested metainf element specifies a FileSet. All files included in this fileset will end up in the META-INF directory of the war file. If this fileset includes a file named MANIFEST.MF, the file is ignored and you will get a warning.

Something like this:

<target name="packwar">
   <war destfile="${appname}.war" webxml="web.xml">
        <lib file="${bin}/myapp.jar"/>
        <metainf file="context.xml" />
   </war>
</target>

There is a similar option - 'webinf' - for deploying to the WEB-INF directory.

Upvotes: 5

Related Questions