Foren

How to put external jars in liferay 7

vel murugan, geändert vor 6 Jahren.

How to put external jars in liferay 7

Junior Member Beiträge: 31 Beitrittsdatum: 19.05.17 Neueste Beiträge
Is there any steps for adding external jars in liferay 7?
thumbnail
Jorge Díaz, geändert vor 6 Jahren.

RE: How to put external jars in liferay 7

Liferay Master Beiträge: 753 Beitrittsdatum: 09.01.14 Neueste Beiträge
thumbnail
Santosh B Biradar, geändert vor 6 Jahren.

RE: How to put external jars in liferay 7

Junior Member Beiträge: 41 Beitrittsdatum: 04.08.15 Neueste Beiträge
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, geändert vor 6 Jahren.

RE: How to put external jars in liferay 7

Junior Member Beiträge: 31 Beitrittsdatum: 19.05.17 Neueste Beiträge
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, geändert vor 6 Jahren.

RE: How to put external jars in liferay 7

Liferay Master Beiträge: 753 Beitrittsdatum: 09.01.14 Neueste Beiträge
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, geändert vor 6 Jahren.

RE: How to put external jars in liferay 7

Junior Member Beiträge: 31 Beitrittsdatum: 19.05.17 Neueste Beiträge
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, geändert vor 6 Jahren.

RE: How to put external jars in liferay 7

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
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, geändert vor 6 Jahren.

RE: How to put external jars in liferay 7

Junior Member Beiträge: 31 Beitrittsdatum: 19.05.17 Neueste Beiträge
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, geändert vor 6 Jahren.

RE: How to put external jars in liferay 7

New Member Beiträge: 18 Beitrittsdatum: 26.03.17 Neueste Beiträge
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, geändert vor 6 Jahren.

RE: How to put external jars in liferay 7

Junior Member Beiträge: 31 Beitrittsdatum: 19.05.17 Neueste Beiträge
I could not able to solve this issue still.
thumbnail
Joye Luo, geändert vor 6 Jahren.

RE: How to put external jars in liferay 7

Regular Member Beiträge: 144 Beitrittsdatum: 03.05.16 Neueste Beiträge
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.