留言板

How to put external jars in liferay 7

vel murugan,修改在6 年前。

How to put external jars in liferay 7

Junior Member 帖子: 31 加入日期: 17-5-19 最近的帖子
Is there any steps for adding external jars in liferay 7?
thumbnail
Jorge Díaz,修改在6 年前。

RE: How to put external jars in liferay 7

Liferay Master 帖子: 753 加入日期: 14-1-9 最近的帖子
thumbnail
Santosh B Biradar,修改在6 年前。

RE: How to put external jars in liferay 7

Junior Member 帖子: 41 加入日期: 15-8-4 最近的帖子
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,修改在6 年前。

RE: How to put external jars in liferay 7

Junior Member 帖子: 31 加入日期: 17-5-19 最近的帖子
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,修改在6 年前。

RE: How to put external jars in liferay 7

Liferay Master 帖子: 753 加入日期: 14-1-9 最近的帖子
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,修改在6 年前。

RE: How to put external jars in liferay 7

Junior Member 帖子: 31 加入日期: 17-5-19 最近的帖子
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,修改在6 年前。

RE: How to put external jars in liferay 7

Liferay Legend 帖子: 14916 加入日期: 06-9-2 最近的帖子
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,修改在6 年前。

RE: How to put external jars in liferay 7

Junior Member 帖子: 31 加入日期: 17-5-19 最近的帖子
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,修改在6 年前。

RE: How to put external jars in liferay 7

New Member 帖子: 18 加入日期: 17-3-26 最近的帖子
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,修改在6 年前。

RE: How to put external jars in liferay 7

Junior Member 帖子: 31 加入日期: 17-5-19 最近的帖子
I could not able to solve this issue still.
thumbnail
Joye Luo,修改在6 年前。

RE: How to put external jars in liferay 7

Regular Member 帖子: 144 加入日期: 16-5-3 最近的帖子
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.