You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matt Veitas <mv...@gmail.com> on 2012/05/23 21:05:25 UTC

Values from pom.xml being injected into deployed jsp attributes

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

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

Posted by Barrie Treloar <ba...@gmail.com>.
On Thu, May 24, 2012 at 9:01 AM, Matt Veitas <mv...@gmail.com> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


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

Posted by Matt Veitas <mv...@gmail.com>.
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 <ba...@gmail.com> wrote:

> On Thu, May 24, 2012 at 4:35 AM, Matt Veitas <mv...@gmail.com> 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
>

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

Posted by Barrie Treloar <ba...@gmail.com>.
On Thu, May 24, 2012 at 4:35 AM, Matt Veitas <mv...@gmail.com> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org