You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by George Christman <gc...@cardaddy.com> on 2014/02/12 16:38:00 UTC

Preferred Template Location

Hi Guys, I'm using 5.4 and my colleague brought to my attention in Igor's
Tapestry5 book he noticed an example where the tml templates were being
packaged together with the java classes. Anyhow I took it a step further
and looked into Geoff's jumpstart package structure and noticed he was
doing the same thing. The question is where is the best place to put the
templates and/or is there a major downside to placing the templates in the
java package?

-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Preferred Template Location

Posted by Geoff Callender <ge...@gmail.com>.
George, I don't use Maven for Tapestry projects, but I think the answer is
here:
http://www.ninthavenue.com.au/how-to-change-mavens-default-resource-folder .


On 13 February 2014 14:23, George Christman <gc...@cardaddy.com> wrote:

> Geoff, I just tried putting a TML into java along side it's java
> counterpart, however it appears as if Tap doesn't know about it. How do you
> tell Tap about it? Also, I'm using Jetty if that matters.
>
>
> On Wed, Feb 12, 2014 at 7:02 PM, Geoff Callender <
> geoff.callender.jumpstart@gmail.com> wrote:
>
> > The only reason I can think of to separate a page or component's source
> > definition files is because something is forcing you to. Why fragment
> > something if you don't have to? I'm not just talking about a page or
> > component's JAVA and TML, I'm including its PROPERTIES and JS. It may
> even
> > have a CSS or LESS that belongs solely to it.
> >
> > IMHO, Maven screwed up our thinking by splitting src/main/ into java/ and
> > resources/ . It makes people hell-bent on separating non-JAVA from JAVA.
> A
> > better split might have been into definition/ and resources/ , where
> > resources/ is for shared stuff.
> >
> >
> > On 13 February 2014 08:56, Chris Poulsen <ma...@nesluop.dk> wrote:
> >
> > > Hi,
> > >
> > > The documentation also has a say on that one:
> > >
> > >
> > >
> >
> http://tapestry.apache.org/component-templates.html#ComponentTemplates-TemplateLocation
> > >
> > > --
> > > Chris
> > >
> > >
> > > On Wed, Feb 12, 2014 at 5:28 PM, Thiago H de Paula Figueiredo <
> > > thiagohp@gmail.com> wrote:
> > >
> > > > On Wed, 12 Feb 2014 13:38:00 -0200, George Christman <
> > > > gchristman@cardaddy.com> wrote:
> > > >
> > > >  Hi Guys, I'm using 5.4 and my colleague brought to my attention in
> > > Igor's
> > > >> Tapestry5 book he noticed an example where the tml templates were
> > being
> > > >> packaged together with the java classes. Anyhow I took it a step
> > further
> > > >> and looked into Geoff's jumpstart package structure and noticed he
> was
> > > >> doing the same thing. The question is where is the best place to put
> > the
> > > >> templates and/or is there a major downside to placing the templates
> in
> > > >> the java package?
> > > >>
> > > >
> > > > Your question is all about where to put sources. It's up to you.
> > > > For Tapestry itself, all it matters is that the templates go into the
> > > > webapp root or classpath; in both cases, in the right folder. I think
> > the
> > > > recommended way is classpath.
> > > >
> > > > My choice? src/main/resources, which later goes to the classpath, no
> > > > doubts about it.
> > > >
> > > > --
> > > > Thiago H. de Paula Figueiredo
> > > > Tapestry, Java and Hibernate consultant and developer
> > > > http://machina.com.br
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> >
>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>

Re: Preferred Template Location

Posted by Lance Java <la...@googlemail.com>.
Guys, I think you're missing the big picture here. As Thiago has said,
tapestry only needs the templates on the classpath.

This is the job of the build tool (ie maven / gradle / ant). If you want
src/main/java to go to your classpath, you need to configure maven to
include these as resources. By default only src/main/resources are copied
into the jar by maven.

IMHO I'm against this sorta maven config and I prefer the sensible maven
conventions.

Re: Preferred Template Location

Posted by George Christman <gc...@cardaddy.com>.
Geoff, I just tried putting a TML into java along side it's java
counterpart, however it appears as if Tap doesn't know about it. How do you
tell Tap about it? Also, I'm using Jetty if that matters.


On Wed, Feb 12, 2014 at 7:02 PM, Geoff Callender <
geoff.callender.jumpstart@gmail.com> wrote:

> The only reason I can think of to separate a page or component's source
> definition files is because something is forcing you to. Why fragment
> something if you don't have to? I'm not just talking about a page or
> component's JAVA and TML, I'm including its PROPERTIES and JS. It may even
> have a CSS or LESS that belongs solely to it.
>
> IMHO, Maven screwed up our thinking by splitting src/main/ into java/ and
> resources/ . It makes people hell-bent on separating non-JAVA from JAVA. A
> better split might have been into definition/ and resources/ , where
> resources/ is for shared stuff.
>
>
> On 13 February 2014 08:56, Chris Poulsen <ma...@nesluop.dk> wrote:
>
> > Hi,
> >
> > The documentation also has a say on that one:
> >
> >
> >
> http://tapestry.apache.org/component-templates.html#ComponentTemplates-TemplateLocation
> >
> > --
> > Chris
> >
> >
> > On Wed, Feb 12, 2014 at 5:28 PM, Thiago H de Paula Figueiredo <
> > thiagohp@gmail.com> wrote:
> >
> > > On Wed, 12 Feb 2014 13:38:00 -0200, George Christman <
> > > gchristman@cardaddy.com> wrote:
> > >
> > >  Hi Guys, I'm using 5.4 and my colleague brought to my attention in
> > Igor's
> > >> Tapestry5 book he noticed an example where the tml templates were
> being
> > >> packaged together with the java classes. Anyhow I took it a step
> further
> > >> and looked into Geoff's jumpstart package structure and noticed he was
> > >> doing the same thing. The question is where is the best place to put
> the
> > >> templates and/or is there a major downside to placing the templates in
> > >> the java package?
> > >>
> > >
> > > Your question is all about where to put sources. It's up to you.
> > > For Tapestry itself, all it matters is that the templates go into the
> > > webapp root or classpath; in both cases, in the right folder. I think
> the
> > > recommended way is classpath.
> > >
> > > My choice? src/main/resources, which later goes to the classpath, no
> > > doubts about it.
> > >
> > > --
> > > Thiago H. de Paula Figueiredo
> > > Tapestry, Java and Hibernate consultant and developer
> > > http://machina.com.br
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Preferred Template Location

Posted by Geoff Callender <ge...@gmail.com>.
The only reason I can think of to separate a page or component's source
definition files is because something is forcing you to. Why fragment
something if you don't have to? I'm not just talking about a page or
component's JAVA and TML, I'm including its PROPERTIES and JS. It may even
have a CSS or LESS that belongs solely to it.

IMHO, Maven screwed up our thinking by splitting src/main/ into java/ and
resources/ . It makes people hell-bent on separating non-JAVA from JAVA. A
better split might have been into definition/ and resources/ , where
resources/ is for shared stuff.


On 13 February 2014 08:56, Chris Poulsen <ma...@nesluop.dk> wrote:

> Hi,
>
> The documentation also has a say on that one:
>
>
> http://tapestry.apache.org/component-templates.html#ComponentTemplates-TemplateLocation
>
> --
> Chris
>
>
> On Wed, Feb 12, 2014 at 5:28 PM, Thiago H de Paula Figueiredo <
> thiagohp@gmail.com> wrote:
>
> > On Wed, 12 Feb 2014 13:38:00 -0200, George Christman <
> > gchristman@cardaddy.com> wrote:
> >
> >  Hi Guys, I'm using 5.4 and my colleague brought to my attention in
> Igor's
> >> Tapestry5 book he noticed an example where the tml templates were being
> >> packaged together with the java classes. Anyhow I took it a step further
> >> and looked into Geoff's jumpstart package structure and noticed he was
> >> doing the same thing. The question is where is the best place to put the
> >> templates and/or is there a major downside to placing the templates in
> >> the java package?
> >>
> >
> > Your question is all about where to put sources. It's up to you.
> > For Tapestry itself, all it matters is that the templates go into the
> > webapp root or classpath; in both cases, in the right folder. I think the
> > recommended way is classpath.
> >
> > My choice? src/main/resources, which later goes to the classpath, no
> > doubts about it.
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

Re: Preferred Template Location

Posted by Chris Poulsen <ma...@nesluop.dk>.
Hi,

The documentation also has a say on that one:

http://tapestry.apache.org/component-templates.html#ComponentTemplates-TemplateLocation

-- 
Chris


On Wed, Feb 12, 2014 at 5:28 PM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Wed, 12 Feb 2014 13:38:00 -0200, George Christman <
> gchristman@cardaddy.com> wrote:
>
>  Hi Guys, I'm using 5.4 and my colleague brought to my attention in Igor's
>> Tapestry5 book he noticed an example where the tml templates were being
>> packaged together with the java classes. Anyhow I took it a step further
>> and looked into Geoff's jumpstart package structure and noticed he was
>> doing the same thing. The question is where is the best place to put the
>> templates and/or is there a major downside to placing the templates in
>> the java package?
>>
>
> Your question is all about where to put sources. It's up to you.
> For Tapestry itself, all it matters is that the templates go into the
> webapp root or classpath; in both cases, in the right folder. I think the
> recommended way is classpath.
>
> My choice? src/main/resources, which later goes to the classpath, no
> doubts about it.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Preferred Template Location

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 12 Feb 2014 13:38:00 -0200, George Christman  
<gc...@cardaddy.com> wrote:

> Hi Guys, I'm using 5.4 and my colleague brought to my attention in Igor's
> Tapestry5 book he noticed an example where the tml templates were being
> packaged together with the java classes. Anyhow I took it a step further
> and looked into Geoff's jumpstart package structure and noticed he was
> doing the same thing. The question is where is the best place to put the
> templates and/or is there a major downside to placing the templates in  
> the java package?

Your question is all about where to put sources. It's up to you.
For Tapestry itself, all it matters is that the templates go into the  
webapp root or classpath; in both cases, in the right folder. I think the  
recommended way is classpath.

My choice? src/main/resources, which later goes to the classpath, no  
doubts about it.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Preferred Template Location

Posted by Dmitry Gusev <dm...@gmail.com>.
This doesn't affect runtime at all whether you put those files to one or
separate source folders, as long as your IDE/build tool adds these
resources to classpath. So this is just a matter of convenience.

I put these files to separate folders and I can still see them together
using the Context View feature of Eclipse plugin:
https://github.com/anjlab/eclipse-tapestry5-plugin#tapestry-context-view


On Wed, Feb 12, 2014 at 8:00 PM, George Christman
<gc...@cardaddy.com>wrote:

> Hi Dmitry, my projects have always been laid out with the template files in
> the resources package as well which works perfectly.
>
> My colleague just happen to see an example where the tml files were placed
> along side there java counterparts and wondered if there was any side
> effect to doing so. I guess he's just looking at is as a convenience within
> the IDE.
>
> So in Source Packages.com.company.project.components can you put
> MyPage.java and MyPage.tml, or would the tml need to be placed in Other
> Sources src/main/resources.com.company.project.components?
>
> Thanks.
>
>
> On Wed, Feb 12, 2014 at 10:51 AM, Dmitry Gusev <dmitry.gusev@gmail.com
> >wrote:
>
> > Hi!
> >
> > *.tml files for pages MAY be placed under web context (src/main/webapp),
> > but component templates MUST be put into classpath to the same package as
> > corresponding Java classes.
> >
> > I always put *.tml files to classpath, which is src/main/resources in my
> > projects layout.
> > I believe this is supported since early versions of tapestry 5.x.
> >
> >
> >
> > On Wed, Feb 12, 2014 at 7:38 PM, George Christman
> > <gc...@cardaddy.com>wrote:
> >
> > > Hi Guys, I'm using 5.4 and my colleague brought to my attention in
> Igor's
> > > Tapestry5 book he noticed an example where the tml templates were being
> > > packaged together with the java classes. Anyhow I took it a step
> further
> > > and looked into Geoff's jumpstart package structure and noticed he was
> > > doing the same thing. The question is where is the best place to put
> the
> > > templates and/or is there a major downside to placing the templates in
> > the
> > > java package?
> > >
> > > --
> > > George Christman
> > > www.CarDaddy.com
> > > P.O. Box 735
> > > Johnstown, New York
> > >
> >
> >
> >
> > --
> > Dmitry Gusev
> >
> > AnjLab Team
> > http://anjlab.com
> >
>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Preferred Template Location

Posted by George Christman <gc...@cardaddy.com>.
Hi Dmitry, my projects have always been laid out with the template files in
the resources package as well which works perfectly.

My colleague just happen to see an example where the tml files were placed
along side there java counterparts and wondered if there was any side
effect to doing so. I guess he's just looking at is as a convenience within
the IDE.

So in Source Packages.com.company.project.components can you put
MyPage.java and MyPage.tml, or would the tml need to be placed in Other
Sources src/main/resources.com.company.project.components?

Thanks.


On Wed, Feb 12, 2014 at 10:51 AM, Dmitry Gusev <dm...@gmail.com>wrote:

> Hi!
>
> *.tml files for pages MAY be placed under web context (src/main/webapp),
> but component templates MUST be put into classpath to the same package as
> corresponding Java classes.
>
> I always put *.tml files to classpath, which is src/main/resources in my
> projects layout.
> I believe this is supported since early versions of tapestry 5.x.
>
>
>
> On Wed, Feb 12, 2014 at 7:38 PM, George Christman
> <gc...@cardaddy.com>wrote:
>
> > Hi Guys, I'm using 5.4 and my colleague brought to my attention in Igor's
> > Tapestry5 book he noticed an example where the tml templates were being
> > packaged together with the java classes. Anyhow I took it a step further
> > and looked into Geoff's jumpstart package structure and noticed he was
> > doing the same thing. The question is where is the best place to put the
> > templates and/or is there a major downside to placing the templates in
> the
> > java package?
> >
> > --
> > George Christman
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
> >
>
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Preferred Template Location

Posted by Dmitry Gusev <dm...@gmail.com>.
Hi!

*.tml files for pages MAY be placed under web context (src/main/webapp),
but component templates MUST be put into classpath to the same package as
corresponding Java classes.

I always put *.tml files to classpath, which is src/main/resources in my
projects layout.
I believe this is supported since early versions of tapestry 5.x.



On Wed, Feb 12, 2014 at 7:38 PM, George Christman
<gc...@cardaddy.com>wrote:

> Hi Guys, I'm using 5.4 and my colleague brought to my attention in Igor's
> Tapestry5 book he noticed an example where the tml templates were being
> packaged together with the java classes. Anyhow I took it a step further
> and looked into Geoff's jumpstart package structure and noticed he was
> doing the same thing. The question is where is the best place to put the
> templates and/or is there a major downside to placing the templates in the
> java package?
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com