DevOps / Maven Interview questions II
How do I include dependencies in a jar using Maven?
Using jar-with-dependencies as the descriptorRef of your assembly-plugin configuration, we can create a JAR along its dependencies.
This built-in descriptor creates an assembly with the classifier jar-with-dependencies using the JAR archive format.
Below is the subset of pom.xml that includes assembly-plugin configuration along with jar-with-dependencies descriptor.
<build> <plugins> <!-- other plugin configuration --> <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin> </plugins> </build>
More Related questions...