users@glassfish.java.net

Re: Configure external libraries as Glassfish modules

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Wed, 06 Jun 2012 23:26:09 +0530

On Wednesday 06 June 2012 10:52 PM, Peter Penzov wrote:
>
> I have several OSGI bundles and WAR packages which use external libraries:
>
> |<dependencies>
>
> <dependency>
> <groupId>javax</groupId>
>
> <artifactId>javaee-web-api</artifactId>
>
> <version>6.0</version>
>
> <scope>provided</scope>
>
> </dependency>
> <dependency>
>
> <groupId>junit</groupId>
>
> <artifactId>junit</artifactId>
>
> <version>4.8.2</version>
>
> <scope>test</scope>
>
> </dependency>
> <dependency>
>
> <groupId>org.osgi</groupId>
>
> <artifactId>org.osgi.core</artifactId>
>
> <version>4.2.0</version>
>
> <scope>provided</scope>
>
> </dependency>
> <dependency>
>
> <groupId>org.osgi</groupId>
>
> <artifactId>org.osgi.compendium</artifactId>
>
> <version>4.2.0</version>
>
> <scope>provided</scope>
>
> </dependency>
> <dependency>
>
> <groupId>org.glassfish</groupId>
>
> <artifactId>osgi-cdi-api</artifactId>
>
> <version>3.1-b41</version>
>
> <type>jar</type>
>
> <scope>provided</scope>
>
> </dependency>
>
> |Instead of building the libraries into every OSGI bundle and WAR package
> is it possible to copy these libraries into /modules directory of the
> Glassfish server. I suppose that it's possible to use only one copy
> without any problem?
>
None of them need to be bundled inside your WAB or added as modules.
They are already available in GlassFish distribution.
>
> I found that these libraries can be deployed as modules in Glassfish
> with the command:
>
> |[root_at_Testserver bin]# sh asadmin add-library /opt/primefaces.jar|
>
This does not apply to OSGi modules. This command adds plain old jars as
libraries for regular apps.

See samples referenced in
http://glassfish.java.net/public/GF-OSGi-Features.pdf

Sahoo