1. 从Liferay官方网站www.liferay.com下载安装文件liferay-portal-pro-3.2.0-tomcat.zip
在D盘创建liferayPro目录,解压缩liferay-portal-pro-3.2.0-tomcat.zip到D:\liferayPro\liferay-portal-pro-3.2.0-tomcat
设置环境变量$CATALINA_HOME= D:\liferayPro\liferay-portal-pro-3.2.0-tomcat
2. 安装test.war
--------------以下引用liferay.com资料
Hot Deploy Portlet WARs
Liferay allows you to easily hot deploy JSR 168 compliant portlets. The following instructions deal with setting up your environment to use Ant to deploy the Test portlet or other JSR 168 compliant portlets.
- Create a portlets directory called /my_portlets.
- Download test.war into /my_portlets. This WAR contains sample JSP and Struts portlets. You can also expand the WAR into /my_portlets/test.war to deploy an expanded WAR.
Download portletsamples.war from Sun into /my_portlets. All of the portlets work except for the Weather Portlet because it requires JSP 1.2 and some of the application servers that Liferay supports do not yet support JSP 1.2.
Download build.xml into /my_portlets. Make sure Ant 1.6.2 and JDK 1.4.2 is set up properly. See Development Environment for instructions on setting up Ant and JDK. - Install either JBoss+Jetty, JBoss+Tomcat, Jetty, or Tomcat.
Edit build.xml to point to your application server or servlet container. For example, if you installed Tomcat to /liferay, edit build.xml to make sure that only the Tomcat section is uncommented and set the property app.server.dir to liferay.
下载的build.xml文件并不一定能用,在这个例子里需要修改成如下:
|
3. 安装Ant
下载Ant安装文件 http://ant.apache.org
解压缩到D:\ant\apache-ant-1.6.2
设置环境变量$ANT_HOME= D:\ant\apache-ant-1.6.2
增加 $ANT_HOME/bin 到 环境变量$PATH中
4. 进入到my_portlets 文件夹(假设在D:\liferayPro\),在Dos窗口下运行ant deploy命令。Ant 会根据build.xml中的设置把test.war部署到D:\liferayPro\liferay-portal-pro-3.2.0-tomcat\webapps\目录下
输出信息如下:
D:\liferayPro\my_portlets>ant deploy
Buildfile: build.xml
init:
deploy:
[java] Deploying test.war
[java] Expanding: .\test.war into 20050625121028802
[java] Modifying 20050625121028802\WEB-INF\web.xml
[java] Copying 69 files to D:\liferayPro\liferay-portal-pro-3.2.0-tomcat\webapps\test
[java] Deleting directory D:\liferayPro\my_portlets\20050625121028802
BUILD SUCCESSFUL
Total time: 3 seconds
D:\liferayPro\my_portlets>
5. 启动 liferay server
D:\liferayPro\liferay-portal-pro-3.2.0-tomcat\bin\startup.bat
6. 测试test.war是否安装成功
1)打开IE,输入http://localhost
2)用户:test@liferay.com 密码:test
3)点击Home
4)查看屏幕下方的下拉框中是否存在Test JSP和Test Struts
5)选中Test JSP,点击Add按钮,如果Test JSP portlet正确显示说明test.war安装好了
7. 接下来我们要创建一个自己的portlet -mytest
8. 新建一个jsp文件welcome.jsp
D:\liferayPro\liferay-portal-pro-3.2.0-tomcat\webapps\test\html\portlet\test_jsp\welcome.jsp
welcome.jsp内容如下:
|
修改D:\liferayPro\liferay-portal-pro-3.2.0-tomcat\webapps\test\WEB-INF\liferay-portlet.xml
粗体部分为要增加的portlet。
10. 修改D:\liferayPro\liferay-portal-pro-3.2.0-tomcat\webapps\test\WEB-INF\portel.xml 增加以下内容到portlet.xml文件中
11. 修改D:\liferayPro\liferay-portal-pro-3.2.0-tomcat\webapps\test\WEB-INF\liferay-display.xml 增加以下内容:
12. 由于Liferay Portal Server采用的是ASP模式,一个服务器可以部署多个公司的Protal。在D:\liferayPro\liferay-portal-pro-3.2.0-tomcat\webapps\test\WEB-INF\web.xml中可是设置test.war属于哪个公司,这里我们不改变web.xml的内容 <web-app>
13. 重复第6步,看看下拉框中是否存在Welcome to My Test Portlet
|