Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An executable uber JAR packages your application so it can start with java -jar while its required dependencies are available from the same distribution. Choose the packaging method that matches your build tool and framework: Maven projects commonly use the Shade Plugin, Spring Boot uses its repackage goal, Spring Boot on Gradle uses bootJar, and other Gradle projects can use Shadow or a custom Jar task.

What an executable uber JAR is

An uber JAR (also called a fat JAR) is a distributable Java archive that contains application code and the dependencies needed at runtime. Executability additionally requires a launchable entry point, normally a manifest Main-Class, so the Java launcher knows which class to invoke.

There are two materially different layouts:

  • Flattened uber JAR: dependency classes and resources are copied into the same archive as your application classes. Maven Shade and typical Shadow or custom Gradle tasks use this style.
  • Nested executable archive: dependency JARs remain inside the outer archive. Spring Boot supplies its own launcher because Java has no general standard mechanism for loading nested JAR files.

Both layouts can be launched with java -jar, but they are not interchangeable packaging formats. Resource merging, class loading, and troubleshooting depend on which layout you produce.

Choose the packaging approach

Project Recommended approach Archive layout Typical build command
Conventional Maven application Apache Maven Shade Plugin Flattened dependency contents mvn package
Spring Boot with Maven spring-boot-maven-plugin and repackage Spring Boot nested-JAR layout mvn package (or mvn package spring-boot:repackage when invoking the goal explicitly)
Spring Boot with Gradle Spring Boot bootJar task Spring Boot nested-JAR layout gradle bootJar
Other Gradle application Shadow plugin or a custom Jar task using zipTree() Usually flattened dependency contents Project-specific Gradle task

Do not select a method based on an assumed speed or size advantage. The reviewed documentation does not establish a universal performance winner; compatibility with your Java, build-tool, framework, dependencies, and resource requirements is the deciding factor.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Maven: create a conventional executable JAR with Shade

The Maven Shade Plugin packages the project artifact together with its dependencies. Its executable-JAR pattern binds the shade goal to the package phase and writes the application entry point into the manifest.

Configure the plugin

Add a plugin execution to pom.xml. The following follows the official example pattern and uses the fully qualified name of your own main class:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <version>3.6.2</version>
  <executions>
    <execution>
      <phase>package</phase>
      <goals><goal>shade</goal></goals>
      <configuration>
        <transformers>
          <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
            <mainClass>example.Main</mainClass>
          </transformer>
        </transformers>
      </configuration>
    </execution>
  </executions>
</plugin>

Replace example.Main with the class that contains your public static void main(String[] args) method. The version shown above is the version in the cited official example at research time, not a timeless recommendation; verify the current plugin release and its compatibility with your Maven and Java versions before adopting it.

Build and run it

  1. Run mvn package from the project directory.
  2. Inspect target/ for the shaded archive. Maven may also leave the original, unshaded artifact there.
  3. Launch the executable archive with java -jar target/your-artifact.jar, using the actual output filename.

If Java reports that no main manifest attribute exists, the archive may contain dependencies but the manifest transformer did not write the correct Main-Class. Check the fully qualified class name and the Shade execution bound to package.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Resources, services, and relocation

Dependencies can contain duplicate resources or Java service-provider metadata. Shade supports resource transformers and package relocation, but there is no single merge rule that is correct for every dependency set. Review the dependencies your application uses and configure the relevant transformers or relocation rules deliberately rather than assuming that copying files is sufficient.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Spring Boot with Maven

Spring Boot uses the spring-boot-maven-plugin to create an executable archive. Its repackage goal operates on the source archive produced by Maven’s package phase; it is not a replacement for running the packaging lifecycle.

Use the parent POM when applicable

A project that uses spring-boot-starter-parent has the repackage execution preconfigured. In that case, the normal command is:

mvn package

Configure repackage explicitly when needed

If the project does not use the Spring Boot parent POM, declare the plugin and its repackage execution in your build, or invoke the goal after packaging:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mvn package spring-boot:repackage

Spring Boot can infer a main class in supported configurations, and its packaging reference also exposes a mainClass setting. Configure that property explicitly when inference is ambiguous or when the project has more than one candidate entry point.

Run the result

After packaging, run the generated Spring Boot archive with:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
java -jar target/your-spring-boot-app.jar

The resulting archive is executable through Spring Boot’s loader and uses nested dependency JARs. It is therefore different from a flattened Shade archive even though both start with java -jar.

Spring Boot with Gradle

For a Spring Boot Gradle project, use the bootJar task supplied by the Spring Boot Gradle plugin:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
gradle bootJar

Run the archive produced under the project’s build output directory with:

java -jar build/libs/your-spring-boot-app.jar

Use the actual filename generated by your project. Spring Boot’s Gradle packaging follows the same nested-JAR model described for its Maven plugin.

Other Gradle projects

Gradle’s file-handling documentation says it does not provide full built-in support for uber JAR creation. For a non-Spring Boot application, choose either the Shadow plugin or a custom Jar task that copies dependency archive contents with zipTree().

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Shadow plugin

The maintained plugin uses the ID com.gradleup.shadow. The Gradle Plugin Portal listed version 9.6.1 at research time, but plugin versions change; verify the current release and compatibility with your Gradle version before adding it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

After applying and configuring Shadow according to its current documentation, build the task it provides (commonly named shadowJar) and run the resulting archive with java -jar. Ensure the generated manifest contains your main class.

Custom Jar task

A custom task can copy the project output and unpacked dependency contents into one archive using Gradle’s zipTree(). The exact dependency configuration and task wiring depend on the project’s Gradle layout, so verify that runtime dependencies, duplicate resources, service descriptors, and the manifest are handled intentionally. A custom task that merely copies files without setting Main-Class will not produce a usable executable JAR.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify the archive before distribution

  1. Confirm the entry point: the manifest must identify the class with the application’s main method.
  2. Inspect the layout: flattened builds should contain dependency classes directly; Spring Boot builds should contain nested dependency archives and Spring Boot loader metadata.
  3. Test the exact command: run java -jar against the built file, not only from an IDE or development classpath.
  4. Exercise dependency features: test logging, service providers, configuration files, reflection-driven libraries, and any native integrations your application uses.
  5. Check duplicate resources: resolve collisions and merge service metadata where required by the libraries in your dependency graph.
  6. Record the build environment: retain the Java, Maven or Gradle, framework, and plugin versions used to create the artifact.

Common failures and fixes

“no main manifest attribute”

The archive lacks a usable Main-Class. Set it through Shade’s ManifestResourceTransformer, the Spring Boot plugin’s mainClass configuration when necessary, or the manifest block of your Gradle task.

Spring Boot repackage does nothing

repackage works on the archive created by the package phase. Run the lifecycle together with the goal, or configure the execution so it runs after packaging. Do not treat spring-boot:repackage as a substitute for producing the source archive.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Gradle cannot find an uber-JAR task

A standard Gradle project does not automatically gain a universal fat-JAR task. Apply Shadow or define a custom Jar task using zipTree(); Spring Boot projects should use bootJar.

Classes or services disappear at runtime

Flattening can expose duplicate files, service descriptors, or package conflicts. Inspect the dependency contents and configure resource transformers, service-file merging, or package relocation where the selected packaging tool supports them.

The archive layout is unexpected

Check whether you selected a flattened tool such as Shade or a Spring Boot nested-JAR task. A nested Spring Boot archive requires Spring Boot’s loader; it is not equivalent to placing every dependency class at the outer archive root.

Version and compatibility cautions

Plugin IDs and versions are time-sensitive. The Maven Shade example used version 3.6.2, and the Shadow listing showed 9.6.1 at the time of the referenced documentation search. Treat those as dated examples, verify current official documentation, and test against the project’s Java and build-tool versions before publishing a build configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can every dependency-containing JAR be called a flattened uber JAR?

No. A flattened uber JAR copies dependency classes and resources into the outer archive. Spring Boot normally keeps dependency JARs nested and uses its own loader.

What is the simplest choice for a non-Spring Maven application?

Configure the Maven Shade Plugin during the package phase and set the manifest Main-Class to your application entry point.

Which Gradle task should a Spring Boot project use?

Use bootJar, then launch the generated archive with java -jar.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.