如何在多个portlet*享jar?

如何在多个portlet*享jar?

问题描述:

我在我的portlet中使用了几个jar,例如c3p0。现在我想避免将jar放在我的每个portlet lib文件夹中。如何在多个portlet*享一个jar文件?我应该如何将它们集成到Eclipse IDE中?添加一个外部jar或将它们放在一个专用项目中并从那里包含它们?

I'm using several jars in my portlets, for instance c3p0. Now I want to avoid to put the jars in every of my portlets lib folders. How can I share one jar file within multiple portlets? And how should I integrate them in the Eclipse IDE? Add an external jar or put them in one dedicated project and include them from there?

另一种解决方案是将它们放在 ../liferay-portal-< version> / tomcat-< version> / webapps / ROOT / WEB-INF / lib

Another solution would be to put them under ../liferay-portal-<version>/tomcat-<version>/webapps/ROOT/WEB-INF/lib

如果你把它们放在这里你可以在portlet liferay-plugin-package.properties 中添加JAR作为你的portlet的依赖项(如果你是使用Liferay Developer Studio或Liferay IDE然后有一个很好的GUI。)

If you place them here you can add the JAR as a dependency for your portlet in the portlets liferay-plugin-package.properties (if you're using Liferay Developer Studio or Liferay IDE then there's a nice GUI for this).

然后部署Liferay将从 ROOT / WEB复制所需的JARS -INF / lib 到您的portlet WEB-INF / lib

Then on deployment Liferay will copy the required JARS from ROOT/WEB-INF/lib to your portlets WEB-INF/lib

我相信是实现它的Liferay支持机制,并且不需要重新启动,因为JAR在部署时被复制到portlet类路径。

This I believe is the Liferay support mechanism for doing it, and doesn't require a restart because the JARs are copied to the portlets classpath on deployment.