您的位置:首页 > Web前端

搭建Liferay Portal 开发环境(Ext Environment)的详细过程

2010-07-12 22:19 615 查看
我下面详细描述搭建Liferay Portal 开发环境的详细过程,这个开发环境主要是Extension Environment(Ext):

1.首先在C盘建立一个目录C:/Liferay_Portal

2.在目录C:/Liferay_Portal下创建data、deploy文件夹.

3.下载tomcat:http://tomcat.apache.org/download-60.cgi

4.将其解压到C:/Liferay_Portal 目录为apache-tomcat-6.0.28.

5.获取到Liferay Portal 的源码.源码我已上传到CSDN中.

6.创建目录C:/Liferay_Portal/workspace,作为Eclipse 的工作区.

7.导入源码Liferay-Src到工程中

8.在工程Liferay-Src中创建文件release.u121979.properties。u121979是我电脑的userName.具体要看你自己的电脑的userName.

C:/Documents and Settings/u121979>

9.在文件release.u121979.properties中设置ext

的目录

lp.ext.dir=C:/Liferay-Portal/workspace/ext

10.在工程Liferay-Src中创建文件app.server.u121979.properties.内容如下:

将源码中的app.server.properties文件中内容全部拷贝到app.server.liuxi.properties文件中,并做如下修改:

app.server.type=tomcat

app.server.parent.dir=C:/Liferay-Portal

app.server.tomcat.version=6.0

app.server.tomcat.dir=${app.server.parent.dir}/apache-tomcat-6.0.28

11.打开Eclipse的Ant视图,将源码中的build.xml拖到其中,展开后如下,



依次点击

clean

start

build-ext

意思就是先清除源码中的所有.class文件,然后重新编译,最后建立ext环境

12.这样在workspace下就创建了一个工程ext,从此就可以在此工程中进行Liferay-Portal的开发了。

最终ext工程的目录结构如下:



其中app.server.u121979.properties是从Liferay-Src源码工程中拷贝过来的,内容一样.

下面再为ext环境配置数据库.

1.打开portal-ext.properties文件



里面的内容为:

##

## You can override portal.properties by specifying your own settings in this

## file.

##

jdbc.default.driverClassName=oracle.jdbc.driver.OracleDriver

jdbc.default.url=jdbc:oracle:thin:@localhost:1521:XE

jdbc.default.username=LIUXI

jdbc.default.password=LIUXI

2.打开META-INF下的ext-spring.xml文件,并在其中写入:

<bean id="liferayDataSource"

class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">

<property name="targetDataSource">

<bean class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean">

<property name="jndiName" value="jdbc/LiferayPool"></property>

</bean>

</property>

</bean>

3.在C:/Liferay-Portal/apache-tomcat-6.0.28/conf/Catalina/localhost下创建Root.xml,其中的内容为:

<Context path="" crossContext="true">
<!-- JAAS -->
<Realm
className="org.apache.catalina.realm.JAASRealm"
appName="PortalRealm"
userClassNames="com.liferay.portal.kernel.security.jaas.PortalPrincipal"
roleClassNames="com.liferay.portal.kernel.security.jaas.PortalRole"
/>
<!--
Uncomment the following to disable persistent sessions across reboots.
-->
<!--<Manager pathname="" />-->
<!--
Uncomment the following to not use sessions. See the property
"session.disabled" in portal.properties.
-->
<!--<Manager className="com.liferay.support.tomcat.session.SessionLessManagerBase" />-->

<Resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:XE"
username="LIUXI"
password="LIUXI"
maxActive="100" maxIdle="30" maxWait="10000" minIdle="0"
minEvictableIdleTimeMillis="1800000" timeBetweenEvictionRunsMillis="60000"
/>

</Context>


4.拷贝oracle驱动程序ojdbc14-10.2.0.4.jar 到C:/Liferay-Portal/apache-tomcat-6.0.28/lib/ext中

5.将ext工程中的build.xml拖到Ant视图中,

然后双击deploy选项,部署ext到tomcat中.

6.为提高tomcat的运行空间,可以在C:/Liferay-Portal/apache-tomcat-6.0.28/bin创建setenv.bat文件:

set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx1024m -XX:MaxPermSize=128m -Dfile.encoding=GBK -Duser.timezone=GMT

7.修改conf目录下的catalina.properties文件,使得common.loader的值如下:

common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/lib/ext/*.jar

8.启动tomcat.在首次启动tomcat过程中会创建数据库表,所以速度比较慢,并且耗内存。

例外tomcat的

9.然后输入http://localhost:8888 (我将tomcat的端口改为8888)

10.成功进入liferay-Portal的主界面,如下



至此,一个ext开发环境搭建好了,接下来就可以在ext-web中写自己的portlet了!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐