Hello,
Although the maven.war.webxml may be cool if you build the web.xml file "on the fly", there are some situations where the fact that the web.xml file is *always* copied and overwritten to the target/webapp/WEB-INF directory does hurt.
For example, in my day to day development, I tell my own Tomcat to point to the /target/webapp/ directory.
But everytime I change a jsp in /src/main/webapp and I want Tomcat to know about it, I run the war:webapp goal, and they are two files copied : my jsp and web.xml (even if it lives in /src/main/webapp/WEB-INF it is overwritten in the target).
As a result, tomcat sees that the web.xml is newer, and then reloads the whole webapp context. Since it may take several seconds (quite frequently 10 to 20 seconds), it is very annoying in such a development cycle.
I digged into the war plugin and saw the "culprit lines" (maven-war-plugin-1.6.1, /plugin.jelly, lines 120 to124) :
<util:available file="${maven.war.webxml}">
<ant:copy file="${maven.war.webxml}"
tofile="${webapp.build.webinf}/web.xml"
overwrite="true" />
</util:available>I guess I can avoid the problem by (solution 1-) setting a "non existing file's filename" into the maven.war.webxml. But it is not very clean/intuitive.
Other solutions may be to :
2- not have this overwrite="true" attribute, but there may be some use cases needing it (?)
3- declare a new plugin property, called something like maven.war.webxml.filter or maven.war.webxml.replace which by default could be set to true (to be backward compatible), but it set to false would make the plugin skip the replacement.
I don't think the second approach is the best, because there are some project teams which may be willing to keep the web.xml file separate from the src/main/webapp/WEB-INF directory, maybe keeping different web.xml versions for different target platforms in src/main/resources/ directory, and still want web.xml to be copied from the good location (based upon some currentTargetPlatform variable).
So maybe the fourth solution may be the good one (the more supple, but still backward compatible) :
4- declare an new plugin property, called maven.war.webxml.alwaysoverwrite, set to true by default.
So my preference would be the solution number 4.
Do you agree with my problem, and do you think there is a chance that it would be addressed in a further release of the war plugin ?
Thanks in advance,
-- Laurent PETIT
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
