Programming/Java
maven-shade-plugin
라우드니스
2020. 11. 6. 11:45
예전에는 maven-assembly-plugin을 사용해서 uber jar를 만들었는데 최근에 필요해서 다시 검색해 보니 maven-shade-plugin이 더 많이 나오는 것으로 보인다.
기본설정으로 만들어진 uber jar의 경우 spark 에서 사용하려고 할 시 manifest 충돌 관련 보안 에러가 발생해서, 홈페이지에서 제공하는 manifest 제외하는 기본 설정 코드를 기록삼아 올려본다. (링크)
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<filters>
<filter>
<artifact>junit:junit</artifact>
<includes>
<include>junit/framework/**</include>
<include>org/junit/**</include>
</includes>
<excludes>
<exclude>org/junit/experimental/**</exclude>
<exclude>org/junit/runners/**</exclude>
</excludes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
</plugins>
</build>
반응형