How to use a jar in several portlets?

I use several mailboxes in my portlets, for example c3p0. Now I want to avoid to put banks in every folder of my lib portlets. How can I share a single jar file in multiple portlets? And how do I integrate them into the Eclipse IDE? Add an external jar or put them in one selected project and include them from there?

+6
jar portlet liferay liferay-6
source share
2 answers

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

If you post them here, you can add a JAR as a dependency for your portlet in the portlets of liferay-plugin-package.properties (if you use Liferay Developer Studio or Liferay IDE, then you need a good GUI for this).

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

This, I believe, is the Liferay support mechanism for this and does not require a restart, since JARs are copied to the portlets class path during deployment.

+6
source share

One way that I can think of is to put them all in a global way.

For example, in Tomcat you can place them in ../liferay-portal-<version>/tomcat-<version>/lib/ext , and then when you set up the server runtime library in eclipse, you will have these banks in your assembly paths.

This link may also help you decide, but it speaks for *-service.jar but I'm not sure that it will work with other banks in any portlet.

+2
source share

All Articles