DBILITY

maven uber-jar packaging 본문

java/basic

maven uber-jar packaging

DBILITY 2018. 4. 30. 19:30
반응형

https://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html

 

POM예시

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  ...
  <build>
    <plugins>
    <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.1.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
            	<goal>shade</goal>
            </goals>
            <configuration>
            	<minimizeJar>false</minimizeJar>
            	<filters>
            		<filter>
            			<artifact>*:*</artifact>
            			<excludes>
            				<exclude>META-INF/*.SF</exclude>
            				<exclude>META-INF/*.DSA</exclude>
            				<exclude>META-INF/*.RSA</exclude>
            			</excludes>
            		</filter>
            	</filters>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>

  </build>
  ...
</project>

 

minimizeJar가 true일 경우 java code나 dependancy에  dynamic class loading이 사용되면 

전부 일일이 포함시켜야 하니, 용량에 신경쓸 일 없다면 그냥 false로 사용이라고 함.

uber-jar 또는 fat-jar라고도 함

반응형
Comments