Forums de discussion

How to put external jars in liferay 7

vel murugan, modifié il y a 6 années.

How to put external jars in liferay 7

Junior Member Publications: 31 Date d'inscription: 19/05/17 Publications récentes
Is there any steps for adding external jars in liferay 7?
thumbnail
Jorge Díaz, modifié il y a 6 années.

RE: How to put external jars in liferay 7

Liferay Master Publications: 753 Date d'inscription: 09/01/14 Publications récentes
thumbnail
Santosh B Biradar, modifié il y a 6 années.

RE: How to put external jars in liferay 7

Junior Member Publications: 41 Date d'inscription: 04/08/15 Publications récentes
Hi,

You can add your external dependencies in build.gradle file. and then build and deploy your module.
Please go through DAVID H NEBINGER blog[https://web.liferay.com/es/web/user.26526/blog/-/blogs/osgi-module-dependencies].

Thanks
Santosh B B
vel murugan, modifié il y a 6 années.

RE: How to put external jars in liferay 7

Junior Member Publications: 31 Date d'inscription: 19/05/17 Publications récentes
Thanks For your Reply . I Followed your mentioned Link"https://web.liferay.com/es/web/user.26526/blog/-/blogs/osgi-module-dependencies" . I added my external jar . when I deploy I got the "org.osgi.framework.BundleException: could not resolve module: searchformportlet [588]_ Unresolved requirements:Import-Package: antlr)[Sanitized]" .(3.png). and Also I attached the build.gradle (1.png) and bnd.bnd (2.png) . Please help me out from this issue.
thumbnail
Jorge Díaz, modifié il y a 6 années.

RE: How to put external jars in liferay 7

Liferay Master Publications: 753 Date d'inscription: 09/01/14 Publications récentes
You have an unresolved dependency with antlr library (http://www.antlr.org/)

One important note: you have to include the dependencies of your code, but also include the dependencies of the added libraries.
vel murugan, modifié il y a 6 années.

RE: How to put external jars in liferay 7

Junior Member Publications: 31 Date d'inscription: 19/05/17 Publications récentes
Thanks for your Reply. when I am adding the latest version of jasper report compileOnly group: 'net.sf.jasperreports', name: 'jasperreports', version: '6.2.0'. it showing following error : Could not resolve all dependencies for configuration ':modules:SearchFormPortlet:compileClasspath'.
> Could not find org.olap4j:olap4j:0.9.7.309-JS-3.
Searched in the following locations:
https://cdn.lfrs.sl/repository.liferay.com/nexus/content/groups/public/org/olap4j/olap4j/0.9.7.309-JS-3/olap4j-0.9.7.309-JS-3.pom
https://cdn.lfrs.sl/repository.liferay.com/nexus/content/groups/public/org/olap4j/olap4j/0.9.7.309-JS-3/olap4j-0.9.7.309-JS-3.jar
Required by:
bsebWorkspace.modules:SearchFormPortlet:1.0.0 > net.sf.jasperreports:jasperreports:6.2.0
. Please help me .
thumbnail
David H Nebinger, modifié il y a 6 années.

RE: How to put external jars in liferay 7

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
Your issue is the transitive dependencies.

You pull in jasper and, for the sake of the build, gradle includes all of the transitive dependencies on antlr, olap4j, etc to be available to complete a satisfactory build.

But this does not include jasper and all of the transitive dependencies into your module. It is up to you as the module developer to include all of the direct dependencies such as jasper as well as each and every one of the indirect, transitive dependencies.










Come meet me at Devcon 2017 or 2017 LSNA!
vel murugan, modifié il y a 6 années.

RE: How to put external jars in liferay 7

Junior Member Publications: 31 Date d'inscription: 19/05/17 Publications récentes
Hi my build.gradle file below

dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "servlet-api", version: "2.5"
compileOnly group: "jstl", name: "jstl", version: "1.2"
compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"


compile project (":modules:customService:customService-api")
compile project (":modules:entityMaster:entityMaster-api")
compile group: 'net.sf.jasperreports', name: 'jasperreports', version: '5.5.1',transitive: false
compile group: 'org.olap4j', name: 'olap4j', version: '1.2.0',transitive: false

}

My bnd.bnd file
Bundle-SymbolicName: searchformportlet
Bundle-Version: 1.0.1
-includeresource: \
@jasperreports-[0-9]*.jar,\
@olap4j-[0-9]*.jar;lib:=true
Import-Package: antlr;resolution:=optional



My Issue is :
I have added my external jar and it came properly when am deploying it showing started and after that it throws error .And in portlet display there is no form fields.

My exception image is below
pleo84 84, modifié il y a 6 années.

RE: How to put external jars in liferay 7

New Member Publications: 18 Date d'inscription: 26/03/17 Publications récentes
Up!
have you solved?

I've got same kind of problem trying to use JasperReport in LR7.

My gradle (project compile well):


repositories {
	maven {
		url "https://cdn.lfrs.sl/repository.liferay.com/nexus/content/groups/public"
		url "http://jaspersoft.artifactoryonline.com/jaspersoft/third-party-ce-artifacts"
	}
}	


dependencies {
	compileOnly group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
	compileOnly group: "com.liferay", name: "com.liferay.osgi.util", version: "3.0.0"
	compileOnly group: "com.liferay", name: "com.liferay.portal.spring.extender", version: "2.0.0"
	compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.6.0"
	
	compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
	compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
	compileOnly group: "com.liferay", name: "com.liferay.registry.api", version: "1.0.0"
	
	compileOnly project(":modules:MyServiceBuilder:MyServiceBuilder-api")
	
	compile group: 'net.sf.jasperreports', name: 'jasperreports', version: '6.4.1'	
}

buildService {
	apiDir = "../MyServiceBuilder-api/src/main/java"
	osgiModule = true
	propsUtil = "com.mine.portlet.servicebuilder.service.util.PropsUtil"
}


and my .bnd

Bundle-SymbolicName: myservicebuilder-service
Bundle-Version: 1.1.2.2
Liferay-Require-SchemaVersion: 1.0.0
Liferay-Service: true

-includeresource: \
@jasperreports-[0-9]*.jar

Import-Package: antlr;resolution:=optional


Compile ok, when i deploy to LR GoGoShell says ok (active) but when i use the portlet i receive error (generic nullpointer). I don't understand:
1) which dependecies i need in includeresource in .bnd
2) more in general, how to import jasperreport in lr7 emoticonemoticon


Thank you!
vel murugan, modifié il y a 6 années.

RE: How to put external jars in liferay 7

Junior Member Publications: 31 Date d'inscription: 19/05/17 Publications récentes
I could not able to solve this issue still.
thumbnail
Joye Luo, modifié il y a 6 années.

RE: How to put external jars in liferay 7

Regular Member Publications: 144 Date d'inscription: 03/05/16 Publications récentes
Hey David,

Is there a better way to resolve transitive dependencies problem?
I just use one third party class and add one third part dependencies in build.gradle file.
But it has numerous dependencies. It seems endless.