gradle shadowjar
时间: 2023-07-14 17:57:50 浏览: 48
Gradle Shadow plugin is used to create uber-jars in Gradle projects. An uber-jar, also known as a fat-jar, contains all the dependencies of a project bundled into a single JAR file. This makes it easier to distribute and run the application without worrying about missing dependencies.
To use the Shadow plugin in a Gradle project, you need to add it to the build script. Here's an example:
```groovy
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.0'
}
// ...
shadowJar {
// configuration options
}
```
After adding the plugin, you can configure it according to your needs. Some common configuration options include changing the output file name, excluding files or directories from the uber-jar, and configuring the manifest.
To build the uber-jar, you can run the following command:
```
gradle shadowJar
```
This will create the uber-jar in the build/libs directory of your project.
I hope this answers your question! If you have any more questions, feel free to ask.