简体   繁体   中英

Make jar with pom dependency in Gradle

I want to make an executable jar in Gradle:

task fatJar(type: Jar) {
    manifest {
           attributes (     
                'Main-Class': 'com.mycompany.json_validator.Main'
            )
    }
    baseName 'json-validator'
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
    with jar
}

But i have an error from Gradle "Could not expand ZIP ..... archive is not a ZIP archive". I have this error on dependency, which is not .jar, it is pom.

compile group: 'org.glassfish.jersey', name: 'jersey-bom', version: '2.17', ext: 'pom'

How can i make an executable jar with it?

This appears to be the same issue described here: Gradle trying to unzip a pom typed dependency

The answer there describes what is happening and a possible remedy.

Alternatively, it should execute if you remove , ext: 'pom' from your dependency though I don't know if this is what you are going for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM