2013-02-27 106 views
1

=(使用CentOS的發行版)=包Javax.portlet不存在

我試圖發展與Grails的一個portlet(使用Liferay的爆,portlet和門戶,Liferay的插件)。

我下面就http://grails.org/plugin/portlets教程,但是當我去生成的portlet視圖,顯示以下錯誤:

[localhost test]$ grails generate-portlet-views com.test.first 
| Compiling 129 source files. 
| Error Compilation error: startup failed: 
Compile error during compilation with javac. 
/home/portaldev1/.grails/2.2.0/projects/test/plugins/portlets-0.9.2/src/java/org/codehaus/grails/portlets/GrailsDispatcherPortlet.java:5: package javax.portlet does not exist 
import javax.portlet.*; 
^ 
/home/portaldev1/.grails/2.2.0/projects/test/plugins/portlets-0.9.2/src/java/org/codehaus/grails/portlets/GrailsDispatcherPortlet.java:10: cannot access javax.portlet.GenericPortlet 
class file for javax.portlet.GenericPortlet not found 

(These problems continue 68 more times) 

Note: Some input files use or override a deprecated API. 
Note: Recompile with -Xlint:deprecation for details. 
Note: Some input files use unchecked or unsafe operations. 
Note: Recompile with -Xlint:unchecked for details. 
70 errors 


1 error 
[localhost test]$ 

我已經提到谷歌/堆棧溢出/ Groovy的論壇/ Liferay的論壇和我發現這個問題的唯一答案是將portlet-api-2.0.jar添加到CLASSPATH環境變量中。

我曾嘗試將此行添加到我的.bash_profile:「CLASSPATH =/home/portletjar /」,並且仍然會出現這些錯誤。

我沒有使用eclipse或其他ide。

請幫我解決這個問題!我也嘗試通過手動定義.jar所在的類路徑(使用javac -cp)來編譯使用javax.portlet的java代碼。

回答

0

你是怎麼準確安裝你的插件的?用grails install-plugin xxx?

檢查在插件會話中是否在conf/BuildConfig.groovy中聲明瞭依賴項。 應該是這樣的句子:

  • 纂 「:門戶,Liferay的:0.4」

希望它可以幫助 乾杯

+0

是的,我用install-plugin xxx爲全部三個(分解,portlet,portlet-liferay)。 我試圖將該行添加到buildconfig,併發生同樣的問題。工作構建配置應該是什麼樣子? – user2116896 2013-03-01 19:17:45

+0

嗨,我試過插件,它似乎是過時的。最後一次更新是2009年6月。它解釋了爲什麼他們不使用Grails 2.2。 我想你可能會在Jira上打開一張票,或者克隆插件來升級它 – bouquetf 2013-03-04 13:55:16

1

添加portlet的API-2.0罐子的/ lib目錄目錄似乎已經解決了這個問題!

+0

非常感謝您發佈您的答案!這非常有幫助。 – grantmcconnaughey 2013-10-10 16:53:04