0 votes
1 view
in Java by (3.4k points)

I want to package my project in a single executable JAR for distribution.

How can I make a Maven project package all dependency JARs into my output JAR?

1 Answer

0 votes
by (46.1k points)

After Creating your project execute this
 

<build>

 <plugins>

   <plugin>

     <artifactId>maven-assembly-plugin</artifactId>

     <configuration>

       <archive>

         <manifest>

           <mainClass>fully.qualified.MainClass</mainClass>

         </manifest>

       </archive>

       <descriptorRefs>

         <descriptorRef>jar-with-dependencies</descriptorRef>

       </descriptorRefs>

     </configuration>

   </plugin>

 </plugins>

</build>

with

mvn clean compile assembly:single

Also, make sure that compile goal is added before assembly:single else the code of your project won’t be included.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...