Search code examples
mavenfilteringweb.xmlmaven-war-plugin

maven-war-plugin not filtering on local


I've been trying to use maven-war-plugin to filter web.xml with profile defined properties, and I made it work on deploying but not on my local server (Apache Tomcat 7.0.65).

I have this on web.xml

<env-entry>
    <env-entry-name>variableName</env-entry-name>
    <env-entry-value>${property.variableName}</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
</env-entry>

This on pom.xml

<property.variableName>This is a variable</property.variableName>

And this on the code:

InitialContext init = new InitialContext();
String variable = (String)init.lookup("java:comp/env/variableName");

The fact is that... on the generated web.xml (target/...web.xml), the variable is filtered with the new value, but deploying on local when I try to print the 'variable' value is logs ${property.variableName}

Any idea about how to fix this?

Thanks in advance and regards,


Solution

  • I finally made it work. Seemed to be something related with deployment assembly which was not recognizing some folders or something like that.

    The following post helped me to find it: Maven: how to fill a variable in web.xml file