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?
相关问题
- Dependencies while implementing Mocking in Junit4
- Unable to generate jar file for Hadoop
- Using task scheduler for running java jar (from ba
- NIO2: how to generically map a URI to a Path?
- The import org.eclipse cannot be resolved
相关文章
- java.lang.NoClassDefFoundError: javax/servlet/http
- Default arguments in JAR-manifest
- intellij build jar artifact containing gradle depe
- Use local jar as a dependency in my Gradle Java pr
- ant jar's mainclass
- IntelliJ compile for Java 7 JRE using Java 8 SDK
- How to create a Liferay 7 structure programmatical
- how to run jar file methods in jsp
One way I can think off is to put all of them in the global path.
For e.g. in Tomcat you could place them at
../liferay-portal-<version>/tomcat-<version>/lib/ext
and then when you configure the server-runtime library in eclipse you will have these jars in your build-path.This link may also help you decide, but it speaks for
*-service.jar
but I am not sure it would work other jars in any one portlet.Another solution would be to put them under
../liferay-portal-<version>/tomcat-<version>/webapps/ROOT/WEB-INF/lib
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).Then on deployment Liferay will copy the required JARS from
ROOT/WEB-INF/lib
to your portletsWEB-INF/lib
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.