I know how to setup Maven to generate a regular JAR file for my project with mvn package. I also know how to setup Maven to generate an executable JAR file with the same command. What I would like to be able to do is to generate a regular JAR file with mvn package and also generate an executable JAR file, either from the same command or with another mvn command. All setup in the same POM file. Thanks!
            Asked
            
        
        
            Active
            
        
            Viewed 25 times
        
    0
            
            
        1 Answers
0
            
            
        add below plugin into your pom.xml:
  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>com.demo.MainTestClass</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>
  </plugins>
after adding this you need to run mvn clean compile assembly:single command from command line.
 
    
    
        Anshul Sharma
        
- 3,432
- 1
- 12
- 17