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!