Modify web.xml after deployment
Is it possible to modify web.xml (or actually any other file) on the application server after deployment? Do all application servers show their deployment / directory structure?
I'd rather make changes locally, rebuild war (or .ear, etc.) and redeploy the app.
Any suggestions / comments. Thank.
source to share
As for your first question, it depends on the type of resource. For a classpath resource, you can override the file in any directory with a higher priority in your application server's class loading mechanism (for example, $ CATALINA_HOME / lib if you are using Tomcat). For an XML file such as web.xml, you can declare the external object in a packed file with an absolute path, but you must be sure that the file will be present on the target server. For example, your packaged web.xml might look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document [
<!ENTITY webEntity SYSTEM 'C:\Temp\web.xml'>
]>
&webEntity;
Thus, the actual content of web.xml will be the content of C: \ Temp \ web.xml.
In short, there is no official way to do this, but there are tricks. I think people are doing this to create a custom package for each production site. There are several ways to automate this with Maven, like war overlays or classifiers. Here's an interesting link .
As for your second question, I would not rely on that assumption. It is quite easy to change the exploded resource on the Tomcat server, but it is not that easy in JBoss AS.
Hello
source to share