메이븐에서 실행가능한 Jar생성을 위한 설정

2021. 11. 17. 16:54 Java 관련/Maven

메이븐에서 실행가능한 Jar생성을 위한 설정

 

<build>
  <plugins>
    <plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-assembly-plugin</artifactId>   
  <configuration>
    <archive>
      <manifest>
        <addClasspath>true</addClasspath>
        <mainClass>was.main.main</mainClass>
      </manifest>
    </archive>
    <descriptorRefs>
      <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
  </configuration>
  <executions>
    <execution>
      <id>make-assembly</id> <!-- this is used for inheritance merges -->
      <phase>package</phase> <!-- bind to the packaging phase -->
      <goals>
        <goal>single</goal>
      </goals>
    </execution>
  </executions>
</plugin>
  </plugins>
</build> 

 

 

참고

http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven


출처: https://happygrammer.tistory.com/20?category=869806 [happygrammer]