Dimitri Kopriwa
Dimitri Kopriwa

Reputation: 14363

Why does gradle produce empty archives?

I have a gradle project made of module and submodules.

| build.gradle (1)
|- common
    | build.gradle (2)
    |- webutils
        | build.gradle (3)
|- spring
    | build.gradle
    |- security
        | build.gradle

This is build.gradle (1)

dependencies {
    compile project(':common'), project(':common:webutils')
    compile project(':spring'), project(':spring:security')
}

This is build.gradle (2)

dependencies {
    compile project(':common:webutils')
}

This is build.gradle (3)

dependencies {
    compile("javax.servlet:javax.servlet-api:${javaxServletApiVersion}")
    testCompile("javax.servlet:javax.servlet-api:${javaxServletApiVersion}")
    testCompile("org.springframework:spring-test:${springVersion}")
    testCompile("junit:junit:${junitVersion}")
}

When I try to build the jars with ./gradlew clean build it procdues the following jar :

  1. /build/libs/libs-0.0.1-SNAPSHOT.jar
  2. common/build/libs/common-0.0.1-SNAPSHOT.jar
  3. common/webutils/build/libs/webutils-0.0.1-SNAPSHOT.jar

I expect

Looking at (1)

" zip.vim version v27
" Browsing zipfile libs-0.0.1-SNAPSHOT.jar
" Select a file with cursor and press ENTER

META-INF/
META-INF/MANIFEST.MF
~                 

Looking at (2)

" zip.vim version v27
" Browsing zipfile common-0.0.1-SNAPSHOT.jar
" Select a file with cursor and press ENTER

META-INF/
META-INF/MANIFEST.MF

Looking at (3)

" zip.vim version v27
" Browsing zipfile webutils-0.0.1-SNAPSHOT.jar
" Select a file with cursor and press ENTER

META-INF/
META-INF/MANIFEST.MF
com/
com/domain/
com/domain/api/
com/domain/api/common/
com/domain/api/common/webutils/
com/domain/api/common/webutils/URLUtils.class
com/domain/api/common/webutils/RandomUtils.class
~              

Upvotes: 0

Views: 1068

Answers (1)

ngreen
ngreen

Reputation: 1769

Java doesn't normally bundle jar dependencies inside other jars. What are the contents of your MANIFEST.MF files? If you want to bundle the dependencies, you might look at the shadow plugin.

Upvotes: 1

Related Questions