Liferay 5.1.2: How to Properly Deploy a Custom Created Theme

1461749, modified 17 Years ago. New Member Posts: 22 Join Date: 10/20/08 Recent Posts
Hi,
I want to create custom themes for Liferay 5.1.2 but im having some issues with the command "ant deploy" with Apache ANT.

I was able to successfully create layouts and even load them into Liferay using directions from threads and the WIKI. Executing a theme seems a little more challenging.

I configured everything properly except for build.${user.name}.properties

I am a little confused with how to properly set the path values and even which values I should be using!

I ran across a few threads and found these:


One Solution
app.server.dir=${project.dir}/../portal
app.server.portal.dir=${app.server.dir}/webapps/ROOT
app.server.classes.portal.dir=${app.server.portal.dir}/WEB-INF/classes
app.server.lib.global.dir=${app.server.dir}/lib/ext
app.server.lib.portal.dir=${app.server.portal.dir}/WEB-INF/lib

Second Solution
app.server.dir=/my-dir/appservers/liferay-portal-tomcat-jdk5-trunk
auto.deploy.dir=${user.home}/liferay/deploy
app.server.lib.portal.dir=/my-dir/liferay/trunk/portal-web/docroot/WEB-INF/lib
app.server.portal.dir=/my-dir/liferay/trunk/portal-web/docroot
javac.compiler=modern

Looking at the paths for the same settings is getting me a little confused on where to properly set them. Any insight would be greatly appreciated


System Config
Fedora
Liferay 5.1.2 Tomcat Bundle
Apache Ant
Liferay SDK
1554724, modified 17 Years ago. New Member Posts: 5 Join Date: 11/7/08 Recent Posts
I just started with Liferay recently, and my experience is that you just build a WAR file and copy it to C:\Documents and Settings\<username>\liferay\deploy, and Liferay will take care of the rest for you.

I don't bother with the provided ant scripts, I found it easier not to use them. I just looked at the liferay plugins sdk, and grabbed the parts I need for a simple portlet, and made my own build script that creates a WAR and copies it for me, as follows:


<project name="PortletTest" default="liferay" basedir=".">
  <target name="liferay">
    <delete file="portletTest.war" />

    <war destfile="portletTest.war" webxml="portlet/WEB-INF/web.xml" duplicate="fail">
      <webinf dir="portlet/WEB-INF">
      	<exclude name="**/liferay*.tld" />
      	<exclude name="web.xml" />
      </webinf>
    	
      <lib dir="lib">
      	<include name="commons-lang*.jar" />
      </lib>
    </war>

    <eclipse.convertpath property="projectName" filesystempath="." />
    <eclipse.refreshlocal resource="${projectName}" />

    <property environment="env" />
    <copy file="portletTest.war" todir="${env.HOMEDRIVE}${env.HOMEPATH}\liferay\deploy" />
  </target>
</project>


In my case, I use Tomcat 5.5, so I manually copied some jars files to Tomcat's shared\lib directory, since they wouldn't work anywhere else (these are jars for JPA and JSTL). Since my portlet is just my own self-tutorial portlet, the only other jar I use is commons lang, referenced above.

I exclude liferay.tld because it is already in the Tomcat container anyway. The web.xml exclusion is just to eliminate complaints about duplicate files, since it already copies web.xml anyway from the webxml attribute.

The standard windows environmant var (I'm using XP) HOMEDRIVE is C: and HOMEPATH is \Documents and Settings\ghall.

The Eclipse tasks just refresh my project so the WAR file shows up in my project. I'm using a little trick to get the project name so I don't have to hard-code it. To run this Ant build in Eclipse, I have to manually specify that Ant runs in the same VM as Eclipse, otherwise the Eclipse tasks will fail to load their Java classes.

Hope that helps.
1554724, modified 17 Years ago. New Member Posts: 5 Join Date: 11/7/08 Recent Posts
Further to my previous post, I tried just downloading the WAR for the simple-unstyled-theme, and dropped it into the same C:\Documents and Settings\<username>\liferay\deploy directory, and it showed up in the list of themes no problem. I was able to apply it to a page.
thumbnail
11279, modified 17 Years ago. Expert Posts: 293 Join Date: 8/14/06 Recent Posts
Take a look at the build.properties files and you see a bunch of commented out sections for whatever app server you have.

So if you downloaded the Liferay-Tomcat(5) bundle, you see this:

#
# Specify the paths to an unzipped Tomcat 5.5.x bundle.
#
app.server.dir=${project.dir}/../bundles/tomcat-5.5.26
app.server.classes.portal.dir=${app.server.portal.dir}/WEB-INF/classes
app.server.lib.global.dir=${app.server.dir}/common/lib/ext
app.server.lib.portal.dir=${app.server.portal.dir}/WEB-INF/lib
app.server.portal.dir=${app.server.dir}/webapps/ROOT

Auto deploy and java compiler settings are already set in build.properties so there really is no need to override these in your build.username.properties



So in the end the only thing you need to put in your build.username.properties is the section above (if you have tomcat5). Just copy and paste it. The only line you will have to change is the first line.

#
# Specify the paths to an unzipped Tomcat 5.5.x bundle.
#
app.server.dir=/yourpathtothebundle/tomcat
app.server.classes.portal.dir=${app.server.portal.dir}/WEB-INF/classes
app.server.lib.global.dir=${app.server.dir}/common/lib/ext
app.server.lib.portal.dir=${app.server.portal.dir}/WEB-INF/lib
app.server.portal.dir=${app.server.dir}/webapps/ROOT


You technically don't even need the last four lines because you haven't overridden them and they are already defined in the build.properties. They are based off the first line.

What this all is anyhow, is that you are pointing the SDK to a deployed set of libraries and jar files so that it can do it's SDK build off of the appropriate Liferay version. Since these plugins are being deployed onto the same app server instance anyway, it makes sense to use the libraries and jar files from that exact same Liferay instance so that there are no conflicts after deployment.

Hope that makes sense.
1461749, modified 17 Years ago. New Member Posts: 22 Join Date: 10/20/08 Recent Posts
That makes perfect sense! Thanks for the help guys. I got it up and running!
1710353, modified 17 Years ago. New Member Post: 1 Join Date: 12/5/08 Recent Posts
Hi

how to change black belt in the pages menu?? I Try everything changes in CMS no effect.

Attachments:

thumbnail
2401061, modified 16 Years ago. Liferay Legend Posts: 2034 Join Date: 3/5/09 Recent Posts
It's called CSS.....