Quantcast

Values from pom.xml being injected into deployed jsp attributes

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Values from pom.xml being injected into deployed jsp attributes

Matt Veitas
Recently the project I am working on ran into a very strange situation when
deploying a war file built with Maven where we were seeing values from the
pom.xml that was within the deployed war file replacing values in our jsp
files at runtime.



Below is a snippet of the xml within our pom.xml file for the web module.

<project>

<parent>

        <groupId>foo</groupId>

        <artifactId>myproject</artifactId>

        <version>1.0-SNAPSHOT</version>

    </parent>

    <artifactId>web</artifactId>

    <packaging>war</packaging>



    <name>MyProject Web</name>





</project>



Some of the JSP files in our project had values such as ${name} and ${url}
that were being replaced somehow at runtime with the values from the maven
pom file. I confirmed that the maven-war-plugin was not doing any
replacement of the jsp files.


Has anybody seen such behavior before?


-Matt
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Values from pom.xml being injected into deployed jsp attributes

Barrie Treloar
On Thu, May 24, 2012 at 4:35 AM, Matt Veitas <[hidden email]> wrote:
> Recently the project I am working on ran into a very strange situation when
> deploying a war file built with Maven where we were seeing values from the
> pom.xml that was within the deployed war file replacing values in our jsp
> files at runtime.
[del]
> Some of the JSP files in our project had values such as ${name} and ${url}
> that were being replaced somehow at runtime with the values from the maven
> pom file. I confirmed that the maven-war-plugin was not doing any
> replacement of the jsp files.

Do you have resource filtering turned on?
http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

To check you should run
mvn help:effective-pom
to ensure that this is not accidentally configured in the parent
hierarchy somewhere

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Values from pom.xml being injected into deployed jsp attributes

Matt Veitas
I confirmed that resource filtering is only happening to the files are
targeting. I also made just to run the maven install with -X to make sure
that the filtering was only happening the specified resources.

If I explode the war file it contains the jsp files that still contain the
${name} and ${url} references. By removing the pom.xml and pom.properties
from the war everything works as expected. Someone brought up a point about
JDK 1.6 and xml based properties files and how it might be something
reading the pom.xml. We haven't been able to figure out what would be
causing it.


-Matt

On Wed, May 23, 2012 at 7:23 PM, Barrie Treloar <[hidden email]> wrote:

> On Thu, May 24, 2012 at 4:35 AM, Matt Veitas <[hidden email]> wrote:
> > Recently the project I am working on ran into a very strange situation
> when
> > deploying a war file built with Maven where we were seeing values from
> the
> > pom.xml that was within the deployed war file replacing values in our jsp
> > files at runtime.
> [del]
> > Some of the JSP files in our project had values such as ${name} and
> ${url}
> > that were being replaced somehow at runtime with the values from the
> maven
> > pom file. I confirmed that the maven-war-plugin was not doing any
> > replacement of the jsp files.
>
> Do you have resource filtering turned on?
> http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
>
> To check you should run
> mvn help:effective-pom
> to ensure that this is not accidentally configured in the parent
> hierarchy somewhere
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Values from pom.xml being injected into deployed jsp attributes

Barrie Treloar
On Thu, May 24, 2012 at 9:01 AM, Matt Veitas <[hidden email]> wrote:
> I confirmed that resource filtering is only happening to the files are
> targeting. I also made just to run the maven install with -X to make sure
> that the filtering was only happening the specified resources.
>
> If I explode the war file it contains the jsp files that still contain the
> ${name} and ${url} references. By removing the pom.xml and pom.properties
> from the war everything works as expected. Someone brought up a point about
> JDK 1.6 and xml based properties files and how it might be something reading
> the pom.xml. We haven't been able to figure out what would be causing it.

Another thought is to grep every file and look for the keys that are
being replaced.
I suspect it may be <exploded.war>/maven/<groupId>/<artifactId>pom.properties
If you can find all the files with those keys, and then "fiddle" with
the values to determine which file is causing the problem that might
help you with extra google queries or questions to mailing lists.

I don't do a lot of web development so I can't offer any more advice.
Someone else might have bright ideas.

It may also be specific to you web container.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...