You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "koos@divpro.co.za" <ko...@divpro.co.za> on 2005/12/05 10:31:06 UTC

[m2] Adding .properties files to the wars that i build

Hi I am trying to add *.properties files that reside in the java package
structure of my project to the war's that I build.

ex.
    java spring controller classes   =
com/fundamo/accountUser/web/controller
        resources (properties files) = com/fundamo/accountUser/web/resources

I tried the following inside my pom.xml but to no avail.
...
<build>
        <resources>        
            <resource>
                <directory>src/main/java/com/fundamo/accountUser/web/resourc
es</directory>
                <targetPath>com/fundamo/accountUser/web/resources</targetPat
h>
                <includes>
                    <include>*.properties</include>
                </includes>
            </resource>            
        </resources>
    </build>
...

Can one of you guys help me in the right direction please?
Koos


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .



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


Re: [m2] Adding .properties files to the wars that i build

Posted by Doug Douglass <dd...@denverdata.com>.
Koos,

First, two things:

   1) You say you're "trying" to add the resources, but never describe 
what the problem is. I presume that the resources you defined are not 
being copied to your webapp/war.

   2) It is a suggested Maven practice to place resources to be bundled 
in your artifact (war file) in src/main/resources. You can create any 
directory/package structure in src/main/resources you wish.


I believe your problem is your includes pattern. Try **/*.properties.

If you are able to move your resources into src/main/resources, as is 
recommended, then you should declare the following in your POM:

<resources>
    <resource>
       <directory>{$basedir}/src/main/resources</directory>
    </resource>
</resources>

HTH,
Doug

koos@divpro.co.za wrote:
> Hi I am trying to add *.properties files that reside in the java package
> structure of my project to the war's that I build.
> 
> ex.
>     java spring controller classes   =
> com/fundamo/accountUser/web/controller
>         resources (properties files) = com/fundamo/accountUser/web/resources
> 
> I tried the following inside my pom.xml but to no avail.
> ...
> <build>
>         <resources>        
>             <resource>
>                 <directory>src/main/java/com/fundamo/accountUser/web/resourc
> es</directory>
>                 <targetPath>com/fundamo/accountUser/web/resources</targetPat
> h>
>                 <includes>
>                     <include>*.properties</include>
>                 </includes>
>             </resource>            
>         </resources>
>     </build>
> ...
> 
> Can one of you guys help me in the right direction please?
> Koos
> 
>

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