Message Boards

how to know current global jar version?

Scarletake Bwi, modified 2 Years ago.

how to know current global jar version?

Expert Posts: 326 Join Date: 12/20/10 Recent Posts

hi

i use liferay 7.4.2 ga3

now i try use poi to operate excel file. i create a -api moduel to do it, and others(i have many) module use dependences to use it.

here is my build.gradle and bnd.bnd

build.gradle

dependencies {
	compileOnly group: "com.liferay.portal", name: "release.portal.api"

	compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
	compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
	compile group: 'org.apache.poi', name: 'poi', version: '3.17'
	compile group: 'org.apache.poi', name: 'poi-excelant', version: '3.17'
	compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.17'
	compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.17'
	compile group: 'org.apache.poi', name: 'poi-scratchpad', version: '3.17'
	compile group: 'org.apache.poi', name: 'ooxml-schemas', version: '1.3'
	compile group: 'org.apache.poi', name: 'ooxml-security', version: '1.1'
	compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.6.0'
}

 

bnd.bnd

Bundle-Name: CI-PoiUtil-api
Bundle-SymbolicName: com.ci.poi
Bundle-Version: 1.0.0
Export-Package: \
    com.ci.poi.*,\
    com.ci.generator.*

Include-Resource:\
    @commons-collections4-4.4.jar,\
    @commons-lang3-3.9.jar,\
    @ooxml-schemas-1.3.jar,\
    @ooxml-security-1.1.jar,\
    @poi-4.1.2.jar,\
    @poi-ooxml-4.1.2.jar,\
    @poi-ooxml-schemas-4.1.2.jar,\
    @poi-excelant-3.17.jar,\
    @poi-scratchpad-4.1.2.jar,\
    @xmlbeans-3.1.0.jar,\
    @SparseBitSet-1.2.jar,\
    @commons-math3-3.6.1.jar
    
Import-Package: \
    !com.sun.*,\
    !junit*,\
    !org.apache.avalon.framework.logger,\
    !org.apache.crimson.jaxp,\
    !org.apache.jcp.xml.dsig.internal.dom,\
    !org.apache.log,\
    !org.apache.xml.resolver*,\
    !org.bouncycastle.*,\
    !org.gjt.xpp,\
    !org.junit*,\
    !org.relaxng.datatype,\
    !org.xmlpull.v1,\
    !com.graphbuilder*,\
    !com.graphbuilder.*,\
    !com.github.luben.zstd.*,\
    !com.github.luben.zstd.*,\
    !com.microsoft.schemas.*,\
    !net.sf.saxon.*,\
    !org.apache.batik.*,\
    !org.apache.jcp.xml.dsig.internal.*,\
    !org.bouncycastle.asn1.*,\
    !org.bouncycastle.*,\
    !org.bouncycastle.cms.*,\
    !org.brotli.dec.*,\
    !org.etsi.uri.*,\
    !org.openxmlformats.schemas.*,\
    !org.tukaani.xz.*,\
    !com.zaxxer.sparsebits.*,\
    !org.apache.commons.codec.*,\
    !org.apache.commons.collections4.*,\
    !org.apache.commons.compress.*,\
    !org.apache.commons.math3.*,\
    !org.apache.xmlbeans.*,\
    !org.w3.x2000.*,\
    \
    *

 

it's work fine.

it's copied from my old version liferay.

my have some questions

1. i' want directly use global jar of liferay, but i do not know is it exsit and it's version, i know all global jar in tomcat-9.0.43\webapps\ROOT\WEB-INF\shielded-container-lib, and i can check it one by one, and open it to see META-INF\MAIFEST.MF. is there any other way or artical can help me to check it?

2. if i use global jar, is that mean, i can use compileOnly to use it? due to the module jar is really fat.

 

thank you in advance.

thumbnail
Russell Bohl, modified 2 Years ago.

RE: how to know current global jar version? (Answer)

Expert Posts: 289 Join Date: 2/13/13 Recent Posts

One way would be to query the OSGi runtime to see what modules are available. Here's an example where I use the Gogo shell to see what org.apache.commons modules are available:

g! lb -s org.apache.commons
START LEVEL 20
   ID|State      |Level|Symbolic name
   56|Active     |    6|org.apache.commons.commons-io (2.8.0)|2.8.0
   57|Active     |    6|org.apache.commons.fileupload (1.3.3)|1.3.3
  216|Active     |   10|org.apache.commons.collections (3.2.2)|3.2.2
  217|Active     |   10|org.apache.commons.lang3 (3.11.0)|3.11.0

 

To use the commons-lang3 module, for example, use this in your build.gradle file:

compileOnly group: "org.apache.commons", name: "commons-lang3", version: "3.11"

Another way would be to follow the documentation on Exported Third Party Packages.