I have several OSGI packages and WAR packages that 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 creating libraries in each OSGI package and WAR package, you can copy these libraries to the / modules directory of the Glassfish server. I believe that only one copy can be used without any problems?
EDIT
I found that these libraries can be deployed as modules in Glassfish with the command:
[ root@Testserver bin]# sh asadmin add-library /opt/primefaces.jar
But then, for example, in a simple WAR package, what do I need to change to use Glassfish modules? Is the WAR package supposed to be configured to use external libraries?
source share