1. 程式人生 > >如何用最暴力的方法改寫Liferay的原生portlet

如何用最暴力的方法改寫Liferay的原生portlet

系列 指定 mes eclipse ice jvm 步驟 unit time

最近在論壇上看到有人問如何改寫Liferay原有的calendar portlet.

然後研究了一下,直接從portal中把calendar portlet的源碼拷貝出來,然後修改再部署上去,但是這個過程中需要一些操作來解決編譯等一系列問題。

環境:

1. Liferay IDE: 3.1 ga1
2. Liferay portal: liferay-portal-tomcat-6.2-ce-ga6-20160112152609836
3. Sdk: liferay-plugins-sdk-6.2-ce-ga6-20160112152609836.zip

步驟:

1.用這個SDK在Liferay IDE中創建一個名為calendar portlet的portlet plugin項目

2. 把這個項目中docroot下的文件全部刪除

3. 把portal中calendar-portlet的源碼拷貝進去,在我電腦上是這個目錄(F:\liferay-bundle\liferay-portal-tomcat-6.2-ee-sp20-20170717160924965\liferay-portal-6.2-ee-sp20\tomcat-7.0.62\webapps\calendar- portlet)

4. 在IDE上把這個portlet刪除(不要刪除源文件),然後把<classpathentry kind="src" path="docroot/WEB-INF/service"/>加到.classpath文件中,再重新導入到IDE中(Import->Liferay Existing SDK Plugin Project)

5. 安裝JDK 6,把當前Eclipse的jre環境換為jdk 1.6,因為6.2的原生portlet需要jvm 6的編譯環境,然後把項目的編譯的級別設為1.6

6. 安裝ant, 把IDE的ant runtime指定為安裝的外部ant

7.然後就ok了,你運行builder-service, compile, war,deploy什麽的都沒有問題了。

下面是論壇的原始回答https://web.liferay.com/community/forums/-/message_boards/view_message/92088815

如何用最暴力的方法改寫Liferay的原生portlet