Specifically, what happened when using Google's API library. How to find out if you search often
from configurations.compile.collect {it.isDirectory() ? it : zipTree(it)}
It's a method, but if pom is included, it will die.
15:44:57: Executing task 'jar'...
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :jar FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':jar'.
> Could not expand ZIP '/xxxxx/.gradle/caches/modules-2/files-2.1/com.sun.xml.bind/jaxb-ri/2.3.2/f37875be0bc7d265b5bbb08eb55b2345c27e67aa/jaxb-ri-2.3.2.pom'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 22s
3 actionable tasks: 1 executed, 2 up-to-date
Cause: archive is not a ZIP archive
15:45:21: Task execution finished 'jar'.
As for the message I'm writing, that's right.
So, if it's pom, it's a solution that you don't have to feed it to zip.
jar {
manifest {
attributes 'Main-Class': 'HOGEHOGE'
}
from {
configurations
.compile
.findAll { !it.name.endsWith('pom') }
.collect { it.isDirectory() ? it : zipTree(it) }
}
}
Surprisingly there was no article, so I hope it helps someone.
[Reference site] https://stackoverflow.com/questions/52816630/unable-to-create-a-jar-of-my-jda-project-because-of-pom-dependency https://qiita.com/informationsea/items/cd1d8d130a5c7b0bc31a