concept uber JAR in category spark

This is an excerpt from Manning's book Spark in Action, Second Edition.
On your journey to deployment, one of your options is to package your application in an uber JAR. As you may recall from chapter 5, an uber JAR is an archive containing all the classes needed by your application, regardless of the number of JARs you had on your class path. The uber JAR contains most, if not all, the dependencies of your application. Logistics are then uber simplified, as you will handle only one JAR. Let’s build an uber JAR with Maven.
To build the uber JAR, you will use the Maven Shade build plugin. You can read its full documentation at http://maven.apache.org/plugins/maven-shade-plugin/index.html .
Listing 6.2 Using the Shade build plugin to build an uber JAR with Maven
<build> <plugins> ... <plugin> <groupId> org.apache.maven.plugins </groupId> #1 <artifactId> maven-shade-plugin </artifactId> #1 <version> 3.1.1 </version> #1 <executions> <execution> <phase> package </phase> #2 <goals> <goal> shade </goal> </goals> <configuration> <minimizeJAR> true </minimizeJAR> #3 <artifactSet> <excludes> #4 <exclude> org.apache.spark </exclude> <exclude> org.apache.hadoop </exclude> ... <exclude> junit:junit </exclude> <exclude> jmock:* </exclude> <exclude> *:xml-apis </exclude> <exclude> log4j:log4j:jar: </exclude> </excludes> </artifactSet> <shadedArtifactAttached> true </shadedArtifactAttached> #5 <shadedClassifierName> uber </shadedClassifierName> #6 </configuration> </execution> </executions> </plugin> </plugins> </build>Exclusions are key; you do not want to carry all your dependencies. If you do not have exclusions, all your dependent classes will be transferred in your uber JAR. This includes all the Spark classes and artifacts. They are indeed needed, but because they are included with Spark, they will be available in your target system. If you bundle them in your uber JAR, that uber JAR will become really big, and you may encounter conflicts between libraries.