包Javax.portlet不存在

时间:2013-02-27 19:54:46

标签: java grails groovy liferay portlet

=(使用CentOS发行版)=

我正在尝试使用Grails开发一个portlet(使用liferay-explosion,portlets和portlets-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]$

我已经提到了google / stack overflow / groovy forums / liferay论坛,我发现这个问题的唯一答案是将portlet-api-2.0.jar添加到CLASSPATH环境变量中。

我已尝试将此行添加到我的.bash_profile:“CLASSPATH = / home / portletjar /”,但仍会出现这些错误。

我没有使用eclipse或任何其他ide。

请帮我解决这个问题!我还尝试通过手动定义.jar所在的类路径来编译使用javax.portlet的java代码(使用javac -cp)。

2 个答案:

答案 0 :(得分:2)

将portlet-api-2.0 jar添加到/ lib目录似乎解决了这个问题!

答案 1 :(得分:0)

你是如何准确安装插件的?使用grails install-plugin xxx?

检查在插件会话中是否在conf / BuildConfig.groovy中声明了依赖项。 它应该是一些像:

  • compile“:portlets-liferay:0.4”

希望它有所帮助 干杯