Search code examples
javamavengrailsbuild-process

Including a jar manifest's classpath in a grails app


I'm writing a grails application (A) that uses a jar (B) from another project. The jar, B, has internal dependancies that are needed at runtime. Here's its manifest:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: robertburke
Build-Jdk: 1.6.0_37
Class-Path: lucene-core-3.3.0.jar postgresql-8.4-702.jdbc4.jar solr-lu
 cene-snowball-1.3.0.jar solr-lucene-core-1.3.0.jar

The grails application can't resolve the classes in the B jar. It gives a:

java.lang.ClassNotFoundException: org.tartarus.snowball.ext.EnglishStemmer

Is there a way to get grails to include the dependency's classpath in its classpath? Is there a way to do it without explicitly adding jar B's dependencies to the grails app?

EDIT: Having a classpath in jar B, which carries its dependancies around like a snail, made the grails app include all the dependencies in the WAR's path.


Solution

  • Assuming that you are using Maven (Plexus Archiver), the POM for module (B) should include the 4 3rd party dependencies and they could be resolved by Grails as transitive dependencies of module (B). If the dependency on module (B) is defined in the application (A) BuildConfig.groovy as a dependency and it is being retrieved from a Maven/Ivy repository (local/remote) than the transitive dependencies should be resolved as well.