Jahia Template Forum > Deploying Templates...

0 (0 Good)
0 (0 Bad)

Deploying Templates and classes in Jahia 5

by  darrenc »  2011/06/07 20:08

Hi all,

I'm working on a project that uses Jahia 5 (jahia5.0.6_r25558 to be exact).

For the first round of development our templates and some custom java classes were all just built by hand and pushed onto the production servers.

I was reading the Jahia Template Developers guide for version 5 and saw that the recommendation is to create a jar with the template JSP files, and within that a jar with any custom java classes.
I followed the instructions for deployment and everything seemed to go okay, the templates were available for me to create a new site with and the classes were copied to the WEB-INF/classes/jahiatemplates directory.

BUT, here's where my problem starts.

My templates can't find the java class files because the paths to the classes are different to my package structures.
Eg if I have a class com.darren.CustomClass it gets deployed to Jahia like this /WEB-INF/classes/jahiatemplates/com/darren/CustomClass.class whereas my template expects it to be in WEB-INF/classes/com/darren

I looked at the sample classes in corporate templates V2 and their package structure is indeed jahiatemplates.org. etc.
But if I create my java sources like that I'll end up with stuff in /WEB-INF/classes/jahiatemplates/jahiatemplates.

For the moment I took my jar with my java classes and put it in the /WEB-INF/lib directory and everything is fine but this will mean a restart for every update to the jar, whereas I was hoping (from my reading of the documentation) to do a hot-deploy without a restart.

How does anyone else do their deployments? Do you make a jar of your templates to deploy or do you just copy the JSPs directly on? Has anyone a way of hot-deploying their java classes (and also properties files) to the jahia servers?


Cheers
Darren
  • Deploying Templates and classes in Jahia 5
    2011/06/07 20:08

    darrenc Hi all,<br/><br/>I'm working on a project that uses Jahia 5 (jahia5.0.6_r25558 to be exact).<br/><br/>For the first round of development our templates and some custom java classes were all just built by hand and pushed onto the production servers.<br/><br/>I was reading the Jahia Template Developers guide for version 5 and saw that the recommendation is to create a jar with the template JSP files, and within that a jar with any custom java classes.<br/>I followed the instructions for deployment and everything seemed to go okay, the templates were available for me to create a new site with and the classes were copied to the WEB-INF/classes/jahiatemplates directory.<br/><br/>BUT, here's where my problem starts.<br/><br/>My templates can't find the java class files because the paths to the classes are different to my package structures.<br/> Eg if I have a class com.darren.CustomClass it gets deployed to Jahia like this /WEB-INF/classes/jahiatemplates/com/darren/CustomClass.class whereas my template expects it to be in WEB-INF/classes/com/darren<br/><br/>I looked at the sample classes in corporate templates V2 and their package structure is indeed jahiatemplates.org. etc.<br/>But if I create my java sources like that I'll end up with stuff in /WEB-INF/classes/jahiatemplates/jahiatemplates.<br/><br/>For the moment I took my jar with my java classes and put it in the /WEB-INF/lib directory and everything is fine but this will mean a restart for every update to the jar, whereas I was hoping (from my reading of the documentation) to do a hot-deploy without a restart.<br/><br/>How does anyone else do their deployments? Do you make a jar of your templates to deploy or do you just copy the JSPs directly on? Has anyone a way of hot-deploying their java classes (and also properties files) to the jahia servers?<br/><br/><br/>Cheers<br/>Darren

  • Number of messages  13
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Deploying Templates and classes in Jahia 5

    by  shyrkov »  2011/06/07 20:08

    Hello Darren,

    in your templates deployment descriptor file ([i:3umadgzj]templates.xml[/i:3umadgzj]) you should add the following element:

    [code:3umadgzj]
    lt;parameter name=
  • Re: Deploying Templates and classes in Jahia 5
    2011/06/07 20:08

    shyrkov Hello Darren,<br/><br/>in your templates deployment descriptor file ([i:3umadgzj]templates.xml[/i:3umadgzj]) you should add the following element:<br/><br/>[code:3umadgzj]<br/>lt;parameter name=

  • Number of messages  407
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Deploying Templates and classes in Jahia 5

    by  darrenc »  2011/06/07 20:08

    Hi Sergiy,

    Thank you very much for that it works perfectly.

    For anyone trying to do the same thing my templates.xml now looks like:

    [code:nsa253zs]
    lt;?xml version=
  • Re: Deploying Templates and classes in Jahia 5
    2011/06/07 20:08

    darrenc Hi Sergiy,<br/><br/>Thank you very much for that it works perfectly.<br/><br/>For anyone trying to do the same thing my templates.xml now looks like:<br/> <br/>[code:nsa253zs]<br/>lt;?xml version=

  • Number of messages  13
    Registration date Jun 7, 2011
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page