replacing web.xml file in a war file

Hi,

I have different web.xml files for localhost and remote deployment, is there a way to replace the web.xml in the war file? thanks.

Angelo

0
7 comments

Hello Angelo,

Are you using IDEA 7? You could define 2 web facets in the same module, with
common resource roots (jsp, html), but different WEB-INF roots with different
web.xml. Then use the first facet for local and another one for remote deployment.

Hi,

I have different web.xml files for localhost and remote deployment, is
there a way to replace the web.xml in the war file? thanks.

Angelo

Alexander.


0
Avatar
Permanently deleted user

Hi, I use this solution (I hope correctly) but actually I have additional question about this one. What if I want to deploy to different servers not only WEB-INF but also some files from root. E.g. in my case default.css file, which is different for every server?

I have global web facet G and server web facets S1 and S2.

My current Web Resource Directories for S1:
web resource = .../G, path to depl. root = /
web resource = .../S1/WEB-INF, path to depl. root = /WEB-INF

Now I have a file .../S1/default.css, how can I include this one?

0

You can remove web root .../S1/WEB-INF and add .../S1 with deployment
path "/" instead.

Hi, I use this solution (I hope correctly) but actually I have additional question about this one. What if I want to deploy to different servers not only WEB-INF but also some files from root. E.g. in my case default.css file, which is different for every server?

I have global web facet G and server web facets S1 and S2.

My current Web Resource Directories for S1:
web resource = .../G, path to depl. root = /
web resource = .../S1/WEB-INF, path to depl. root = /WEB-INF

Now I have a file .../S1/default.css, how can I include this one?



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Avatar
Permanently deleted user

Yes but then both fields are yellow and there is popup msg "Duplicated relative deployment path '/'".

Can I use this? I mean do you guarantee that files from facet S1 will be always copied after the files from facet G and ovewrite them (that's what I need)? How IDEA knows which facet should copy first and which second...

0

Yes but then both fields are yellow and there is popup msg "Duplicated relative deployment path '/'".

It's just a warning.

Can I use this? I mean do you guarantee that files from facet S1 will be always copied after the files from facet G and ovewrite them (that's what I need)? How IDEA knows which facet should copy first and which second...

Files from web roots are copied in order specified by their positions in
"Web Resource Directories" table. But if a file is already exist it
won't be overwritten so you should ensure that /S1 is above /G in the table.

--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Avatar
Permanently deleted user

Thanks this helps a lot!

0
Avatar
Permanently deleted user

Why do you have multiple web.xml files for the same application?

Having multiple files for what's essentially the same thing tends to lead to problems. It's a violation of the DRY principle. At some point someone changes one occurrence, but forgets the others. And then you get those nice 'works for me' responses from developers to issues reported on another environment (e.g production)...

Vincent

0

Please sign in to leave a comment.