Include flatDir jar's manifest classpath jars in dependencies

Is there a way to have a flatDir jar’s manifest jars also included in the dependencies?

I am trying to include my JEE application servers libs (weblogic). I am migrating from an ant script which references these jars by setting up the PATH and CLASSPATH environment variables before running the ant script.

The weblogic.jar has a MANIFEST.MF with relative classpath references to other dependent jars. This sits at c:/opt/weblogic/wl10.3.2.0/wlserver_10.3/server/lib/weblogic.jar.

In gradle.properties:

BEA_HOME=c:/opt/weblogic/wl10.3.2.0
WLS_HOME=c:/opt/weblogic/wl10.3.2.0/wlserver_10.3
org.gradle.java.home=c:/opt/weblogic/wl10.3.2.0/jdk160_14_R27.6.5-32

build.gradle

repositories {
    flatDir dirs: "$WLS_HOME/server/lib"
}

dependencies {
    compile name: 'weblogic'
}

Is there a way to have all the relative libs on the weblogic.jar manifest be included as dependencies as well?

That’s what dependency management is for really. The metadata defines the dependency you want in your project plus its transitive dependencies. Instead of using hard-coded paths to a Weblogic installation (which will likely be different for different developers), I try to resolve the dependencies from a repository. Gradle’s dependency management will take care of resolving transitive dependencies.

If you really want to implement your approach, you could but you’d have to put a custom solution in place.

I would love for that to happen, but weblogic 10.3 doesn’t supply any pom artifacts for it’s libraries Trying to figure out those transitive dependencies and add them to a repo manually seems like a nightmare.

Do you have any tips on how to approach importing the manifest classpath into the gradle dependencies?

I would love for that to happen, but weblogic 10.3 doesn’t supply any pom artifacts for it’s libraries.

OK, that changes things. :smile:

Trying to figure out those transitive dependencies and add them to a repo manually seems like a nightmare.

I’d simply include all JAR files in the server/lib directory. See file dependencies in the Gradle user guide.

Do you have any tips on how to approach importing the manifest classpath into the gradle dependencies?

You’d have to read the manifest from the JAR file via Java or Groovy as you’d usually do in a program.

Looks like we are upgrading to weblogic 12c which has support for syncing jars to a local maven repo via a tool they provide. Unfortunately the added jars do not have any transitive dependency information, so I have to still hand pick the proper all the jars, but better than before!