You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Nagur B <na...@tcs.com> on 2007/11/30 09:02:08 UTC

issue with filtering in Maven2

Dear all,

My dev environment is - Struts2, Spring Maven version: 2.0.5

Problem: ${user.id} in the struts.xml is getting replaced by the value of 
project.artifactID by maven2 filter plugin

Description:
part of my struts.xml : 
                <action name="saveUser" class=
"com.user.web.action.UserAction" method="save">
                        <result name="success" type="redirect-action">
                                <param name="actionName">
showUserDetails.action</param>
                                <param name="user.id">${user.id}</param>
                        </result>
                        <result name="input">/jsp/user/addUser.jsp</result
>
                </action>

After the save happens the user is redirected to another action 
showUserDetails.action and setting the property of {user.id} dynamically.

But When the build happens, the above ${user.id}  is getting replaced by 
com.myproject:war:0.1-SNAPSHOT during build time.

I suspect that maven resources plugin / filter plugin is confusing the 
user.id property to project.artifactId property.

Any help appreciated


thnks and rgds,
Basav
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



Re: issue with filtering in Maven2

Posted by Stephen Connolly <st...@gmail.com>.
Just spotted that you're using a war.

You could do the same for the webapps too.

I have yet to come up with a good structure for the webapp problem...

do I go:

/src/filtered/resources
/src/filtered/webapp

/src/main/resources
/src/main/webapp

/src/test/resources

/src/where do the filtered test resources go

do I go

/src/main/filtered/resources
/src/main/filtered/webapp
/src/main/verbatim/resources
/src/main/verbatim/webapp

(breaking a well established pattern for webapps in Maven2)

I currently use

/src/main/resources/filtered
/src/main/resources/verbatim
/src/main/webapp
/src/filtered/webapp

with
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <webResources>
                        <resource>

<directory>${basedir}/src/filtered/webapp</directory>
                            <filtering>true</filtering>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>

I find it strange that I cannot move the /src/main/webapp with the war
plugin (it seems to always be there by default), and I'm not exactly
happy about the directory structure compromise I've picked.

-Stephen

On Nov 30, 2007 8:37 AM, Stephen Connolly
<st...@gmail.com> wrote:
> I normally have two subfolders of resources:
>
> /src/main/resources/verbatim
> /src/main/resources/filtered
> /src/test/resources/verbatim
> /src/test/resources/filtered
>
> with the following in the build section of the pom
>
>         <resources>
>             <resource>
>                 <filtering>false</filtering>
>                 <directory>${basedir}/src/main/resources/verbatim</directory>
>             </resource>
>             <resource>
>                 <filtering>true</filtering>
>                 <directory>${basedir}/src/main/resources/filtered</directory>
>             </resource>
>         </resources>
>         <testResources>
>             <testResource>
>                 <filtering>false</filtering>
>                 <directory>${basedir}/src/test/resources/verbatim</directory>
>             </testResource>
>             <testResource>
>                 <filtering>true</filtering>
>                 <directory>${basedir}/src/test/resources/filtered</directory>
>             </testResource>
>         </testResources>
>
> That way if I have problems with resources getting unwanted filtering,
> they go into verabtim
>
>
> On Nov 30, 2007 8:02 AM, Nagur B <na...@tcs.com> wrote:
> > Dear all,
> >
> > My dev environment is - Struts2, Spring Maven version: 2.0.5
> >
> > Problem: ${user.id} in the struts.xml is getting replaced by the value of
> > project.artifactID by maven2 filter plugin
> >
> > Description:
> > part of my struts.xml :
> >                 <action name="saveUser" class=
> > "com.user.web.action.UserAction" method="save">
> >                         <result name="success" type="redirect-action">
> >                                 <param name="actionName">
> > showUserDetails.action</param>
> >                                 <param name="user.id">${user.id}</param>
> >                         </result>
> >                         <result name="input">/jsp/user/addUser.jsp</result
> > >
> >                 </action>
> >
> > After the save happens the user is redirected to another action
> > showUserDetails.action and setting the property of {user.id} dynamically.
> >
> > But When the build happens, the above ${user.id}  is getting replaced by
> > com.myproject:war:0.1-SNAPSHOT during build time.
> >
> > I suspect that maven resources plugin / filter plugin is confusing the
> > user.id property to project.artifactId property.
> >
> > Any help appreciated
> >
> >
> > thnks and rgds,
> > Basav
> > =====-----=====-----=====
> > Notice: The information contained in this e-mail
> > message and/or attachments to it may contain
> > confidential or privileged information. If you are
> > not the intended recipient, any dissemination, use,
> > review, distribution, printing or copying of the
> > information contained in this e-mail message
> > and/or attachments to it are strictly prohibited. If
> > you have received this communication in error,
> > please notify us by reply e-mail or telephone and
> > immediately and permanently delete the message
> > and any attachments. Thank you
> >
> >
> >
>

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


Re: issue with filtering in Maven2

Posted by Stephen Connolly <st...@gmail.com>.
I normally have two subfolders of resources:

/src/main/resources/verbatim
/src/main/resources/filtered
/src/test/resources/verbatim
/src/test/resources/filtered

with the following in the build section of the pom

        <resources>
            <resource>
                <filtering>false</filtering>
                <directory>${basedir}/src/main/resources/verbatim</directory>
            </resource>
            <resource>
                <filtering>true</filtering>
                <directory>${basedir}/src/main/resources/filtered</directory>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <filtering>false</filtering>
                <directory>${basedir}/src/test/resources/verbatim</directory>
            </testResource>
            <testResource>
                <filtering>true</filtering>
                <directory>${basedir}/src/test/resources/filtered</directory>
            </testResource>
        </testResources>

That way if I have problems with resources getting unwanted filtering,
they go into verabtim

On Nov 30, 2007 8:02 AM, Nagur B <na...@tcs.com> wrote:
> Dear all,
>
> My dev environment is - Struts2, Spring Maven version: 2.0.5
>
> Problem: ${user.id} in the struts.xml is getting replaced by the value of
> project.artifactID by maven2 filter plugin
>
> Description:
> part of my struts.xml :
>                 <action name="saveUser" class=
> "com.user.web.action.UserAction" method="save">
>                         <result name="success" type="redirect-action">
>                                 <param name="actionName">
> showUserDetails.action</param>
>                                 <param name="user.id">${user.id}</param>
>                         </result>
>                         <result name="input">/jsp/user/addUser.jsp</result
> >
>                 </action>
>
> After the save happens the user is redirected to another action
> showUserDetails.action and setting the property of {user.id} dynamically.
>
> But When the build happens, the above ${user.id}  is getting replaced by
> com.myproject:war:0.1-SNAPSHOT during build time.
>
> I suspect that maven resources plugin / filter plugin is confusing the
> user.id property to project.artifactId property.
>
> Any help appreciated
>
>
> thnks and rgds,
> Basav
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>

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