DBILITY

maven jar build시 meta-inf 제거 본문

java/basic

maven jar build시 meta-inf 제거

DBILITY 2016. 10. 21. 16:30
반응형

maven jar build시 META-INF정보를 제거하고 싶을때, maven-shade-plugin을 사용합니다.

pom.xml에 아래와 같이 추가하고,build 하십시오.
maven folder만 제거할 경우 META-INF/maven/**으로 변경합니다.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>2.4.1</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <artifactSet>
                    <includes>
                        <include>${project.groupId}:${project.artifactId}</include>
                    </includes>
                </artifactSet>
                <filters>
                    <filter>
                        <artifact>*:*</artifact>
                        <excludes>
                            <exclude>META-INF/</exclude>
                        </excludes>
                    </filter>
                </filters>
            </configuration>
        </execution>
    </executions>
</plugin>

참고로 war내의 META-INF는 maven-war-plugin configuration에 다음과 같이 설정 할 수 있습니다.

<archive>
    <addMavenDescriptor>false</addMavenDescriptor>
</archive>
반응형
Comments