You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Chiappone <ch...@gmail.com> on 2007/07/18 21:59:05 UTC

Overriding default location of properties files

I am wondering if anyone has any pointers on how I could change the
location of where my properties files are.  I am looking to move them
to a separate directory to clean up my application.

Thanks,

-- 
~chris

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


Re: Overriding default location of properties files

Posted by Steven Coco <co...@stevencoco.com>.
On Wed July 18 2007 3:59:05 pm you wrote:
> I am wondering if anyone has any pointers on how I could change the
> location of where my properties files are.  I am looking to move them
> to a separate directory to clean up my application.
>
> Thanks,

One way is to use Maven...

If I understand what you're asking correctly, then you can set up any source 
directory structure you like with Maven. I have switched to a setup like this 
myself:

The java files:

src/main/java/
src/main/java/base/
src/main/java/components/
src/main/java/pages/
src/main/java/services/

The .properties files:

src/main/resources/
src/main/resources/base/
src/main/resources/components/
src/main/resources/pages/
src/main/resources/services/

The html templates:

src/main/tapestry/
src/main/tapestry/components/
src/main/tapestry/pages/

The WebApp files:

src/main/webapp/
src/main/webapp/META-INF/context.xml
src/main/webapp/WEB-INF/
src/main/webapp/WEB-INF/application.properties
src/main/webapp/WEB-INF/web.xml

(Maven has a standard layout, which this augments. You can read the Maven 
documentation for more: http://maven.apache.org/guides/ )

I am very new, and so far have only touched the surface of Tapestry, but this 
is working for me.

You may have troubles if you're using Jetty and expecting things to 
auto-reload after changes. Jetty likely is configured to scan certain 
directories and notice changes, so it may not find everything if it is not 
programmed to look in other source and resource folders -- though in theory 
it can parse the POM and find out which directories to scan.

To make the Maven POM, you need only add this resource declaration to your 
POM:


<project ...
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/tapestry</directory>
            </resource>
        </resources>
        ...


The filtering on your properties files is optional.

This seems to be working for me. I use Maven 2.0.6, Tomcat in deployment, and 
Tap 5.0.5 (the released version).

Good luck.

Ciao!
-Steev Coco.

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


Re: Overriding default location of properties files

Posted by Jesse Kuhnert <jk...@gmail.com>.
Sure - I would look at "org.apache.tapestry.namespace-properties-name" :

http://tapestry.apache.org/tapestry4.1/usersguide/configuration.html#Configuration%20Properties

I also recently made a few changes such that you could - in theory - have
one single monolithic properties file for everything. (if you would want to
do that)  Prior to that if you defined a library within your app for your
own custom components it would not get access to the properties defined in
your <application name>.properties file.  This has since been fixed. (same
goes for inheriting .application/jwc/page spec meta properties)

On 7/18/07, Chris Chiappone <ch...@gmail.com> wrote:
>
> I am wondering if anyone has any pointers on how I could change the
> location of where my properties files are.  I am looking to move them
> to a separate directory to clean up my application.
>
> Thanks,
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com