You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rick R <ri...@gmail.com> on 2010/05/21 22:55:10 UTC

toughest time trying to get a jsp filtered.. any help much appreciated

I'd like to have a jsp in the root of src/main/webapps filtered and the var
replaced with a property in the war's pom.

In my pom I have:

<properties>
      <foo.bar>FOO/foo.bar>
</properties>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.0.2</version>
    <configuration>
        <webResources>
            <resource>
                <directory>src/main/webapp</directory>
                <includes>
                    <include>**/*.jsp</include>
                </includes>
                <filtering>true</filtering>
                <!--<targetPath> </targetPath>  tried also setting this to
src/main/webapps-->
            </resource>
        </webResources>
    </configuration>
</plugin>


I have an index.jsp with

${foo.bar} defined in it.

When I run mvn clean install, I never see this var replaced in the index.jsp
in the exploded dir in target.

Any ideas what I'm doing wrong?

I found this article online and it looks like I'm doing everything
correctly.
http://fogit.blogspot.com/2009/07/web-resources-filtering-with-maven-2.html
The difference in that article is he has his jsp's in a pages dir, and mine
are right out in the root (some are also under WEB-INF/jsp but the one I
want filtered is in the root of the webapp.)

Re: toughest time trying to get a jsp filtered.. any help much appreciated

Posted by Wayne Fay <wa...@gmail.com>.
> <properties>
>       <swf.version>1.0-SNAPSHOT</swf.version>
> </properties>

Most likely it would have worked if you would simply use underscore
(_) instead of dot (.).

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: toughest time trying to get a jsp filtered.. any help much appreciated

Posted by Rick R <ri...@gmail.com>.
[SOLVED] not sure how because I've modified too many things since I came
back to looking at this issue.

On Sat, May 22, 2010 at 7:15 AM, Martin Gainty <mg...@hotmail.com> wrote:

>
>
> you're probably want to consider a templating language such as FTL/VM..
> i'll borrow this test-include from FreeMarker
>


Well in this case I really don't. That would require just one more external
file to manage. In this simple case all I wanted to do is make sure that a
version number declared as a dependency in my web app's pom (for a swf file)
was actually used a version number I could use in one of my jsps. I only
wanted to make this change in one place when the version number changed.
Since the pom obviously needed to know this version number for sure, it made
sense to me to just have a way to access it from the pom file.

Thanks for everyone's patience. I'm sure it was something really stupid I
was doing since this original description on using the maven-war webResoures
task is working just fine now:

http://fogit.blogspot.com/2009/07/web-resources-filtering-with-maven-2.html

RE: toughest time trying to get a jsp filtered.. any help much appreciated

Posted by Martin Gainty <mg...@hotmail.com>.
Hi Rick

 

you're probably want to consider a templating language such as FTL/VM.. i'll borrow this test-include from FreeMarker


<!-- first the assignment in nestedinclude.ftl ...this is where the assignment of external property takes place -->

<#assign nestedMessage = "I'm here, mon!">

 

<!-- then blat  output in jsp -->

<html>
<head>
<title>FreeMarker: Include Instruction Test</title>
</head>
<body>

<p>A simple test follows:</p>

<p>Test normal includes:</p>
<!--include in jsp -->
<#include "nestedinclude.ftl">

${nestedMessage}

</body>
</html>

 

?

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.



 

> From: rickcr@gmail.com
> Date: Sat, 22 May 2010 00:01:27 -0400
> Subject: Re: toughest time trying to get a jsp filtered.. any help much appreciated
> To: users@maven.apache.org
> 
> On Fri, May 21, 2010 at 11:53 PM, Rick R <ri...@gmail.com> wrote:
> 
> >
> >
> > On Fri, May 21, 2010 at 9:44 PM, Wayne Fay <wa...@gmail.com> wrote:
> >
> >> > <properties>
> >> > <foo.bar>FOO/foo.bar>
> >> > </properties>
> >>
> >> If this is literally cut and paste from your pom.xml file, the problem
> >> should be pretty obvious. If you changed it and accidentally deleted
> >> the <, that's another story.
> >>
> >
> >
> > Ha sorry. no it wasn't cut and paste:) I see the mistake above. I had
> > several properties and then pasted them here and just screwed up making it
> > more generic. Thanks though.
> >
> 
> 
> I also ended up getting around the problem (in a flex/java app) by
> utilizing the flex mojos copy-flex-resources goal of the plugin.
> 
> However, I still would be curious why I wasn't have it filter correctly for
> the jsp. The plugin section was copy and paste:
> 
> <plugin>
> <groupId>org.apache.maven.
> plugins</groupId>
> <artifactId>maven-war-plugin</artifactId>
> <version>2.0.2</version>
> <configuration>
> <webResources>
> <resource>
> <directory>src/main/webapp</directory>
> <includes>
> <include>**/*.jsp</include>
> </includes>
> <filtering>true</filtering>
> <!--<targetPath> </targetPath> tried also setting this to
> src/main/webapps-->
> </resource>
> </webResources>
> </configuration>
> </plugin>
> 
> The relevant property I was trying to replace.. copy and paste:
> 
> <properties>
> <swf.version>1.0-SNAPSHOT</swf.version>
> </properties>
> 
> and then from a snippet in the index.jsp
> 
> 
> "src", "integrated-media-swf-${swf.version}.swf"
 		 	   		  
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Re: toughest time trying to get a jsp filtered.. any help much appreciated

Posted by Rick R <ri...@gmail.com>.
On Fri, May 21, 2010 at 11:53 PM, Rick R <ri...@gmail.com> wrote:

>
>
> On Fri, May 21, 2010 at 9:44 PM, Wayne Fay <wa...@gmail.com> wrote:
>
>> > <properties>
>> >      <foo.bar>FOO/foo.bar>
>> > </properties>
>>
>> If this is literally cut and paste from your pom.xml file, the problem
>> should be pretty obvious. If you changed it and accidentally deleted
>> the <, that's another story.
>>
>
>
> Ha sorry. no it wasn't cut and paste:) I see the mistake above. I had
> several properties and then pasted them here and just screwed up making it
> more generic. Thanks though.
>


 I also ended up getting around the problem (in a flex/java app) by
utilizing the flex mojos copy-flex-resources goal of the plugin.

However, I still would be curious why I wasn't have it filter correctly for
the jsp. The plugin section was copy and paste:

<plugin>
    <groupId>org.apache.maven.
plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.0.2</version>
    <configuration>
        <webResources>
            <resource>
                <directory>src/main/webapp</directory>
                <includes>
                    <include>**/*.jsp</include>
                </includes>
                <filtering>true</filtering>
                <!--<targetPath> </targetPath>  tried also setting this to
src/main/webapps-->
            </resource>
        </webResources>
    </configuration>
</plugin>

The relevant property I was trying to replace.. copy and paste:

<properties>
       <swf.version>1.0-SNAPSHOT</swf.version>
</properties>

and then from a snippet in the index.jsp


"src", "integrated-media-swf-${swf.version}.swf"

Re: toughest time trying to get a jsp filtered.. any help much appreciated

Posted by Rick R <ri...@gmail.com>.
On Fri, May 21, 2010 at 9:44 PM, Wayne Fay <wa...@gmail.com> wrote:

> > <properties>
> >      <foo.bar>FOO/foo.bar>
> > </properties>
>
> If this is literally cut and paste from your pom.xml file, the problem
> should be pretty obvious. If you changed it and accidentally deleted
> the <, that's another story.
>


Ha sorry. no it wasn't cut and paste:) I see the mistake above. I had
several properties and then pasted them here and just screwed up making it
more generic. Thanks though.

Re: toughest time trying to get a jsp filtered.. any help much appreciated

Posted by Wayne Fay <wa...@gmail.com>.
> <properties>
>      <foo.bar>FOO/foo.bar>
> </properties>

If this is literally cut and paste from your pom.xml file, the problem
should be pretty obvious. If you changed it and accidentally deleted
the <, that's another story.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org