0

I need to convert my Java project to an executable JAR file with Gradle and I keep getting this error: "archive is not a ZIP archive". Here is a screenshot of the error: https://i.stack.imgur.com/D9nGq.png

I'm not quite sure why this is happening. I've tried different things in my build.gradle but nothing seems to work. It still creates the JAR, but it seems to miss some dependencies, probably because it runs into the error before it can compile all of the dependencies.

Here is my build.gradle:

plugins {
    id 'java'
}

group 'onixo-dev'
version ''

repositories {
    jcenter()
}

dependencies {
    compile 'net.dv8tion:JDA:4.2.0_227'
    compile 'com.jagrosh:jda-utilities:3.0.5'
    compile 'com.squareup.okio:okio:2.10.0'
    compile 'net.sf.trove4j:trove4j:3.0.3'
    compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.12.1'
}

jar {
    manifest {
        attributes "Main-Class": "onixodev.Main"
    }

    from {
        configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

Any help would be super appreciated!

Avum
  • 1
  • See https://stackoverflow.com/a/32367910/104891. You are trying to use a dependency of `pom` type instead of `jar`. – CrazyCoder Feb 09 '21 at 23:25
  • @CrazyCoder Ah, I see. The error is coming from opus-java though and I'm not manually compiling that. How would I change that to a JAR file? – Avum Feb 10 '21 at 10:03
  • See https://stackoverflow.com/a/56090858/104891. – CrazyCoder Feb 11 '21 at 01:30

0 Answers0