2012-01-19 7 views
9

tomcat zip 아티팩트를 다운로드하고 tomcat이라는 폴더에 int를 압축하려고합니다. 내가 얻는 것은 tomcat/apache-tomcat-7.0.19/ 입니다. 귀찮은 중간 디렉토리를 제거하려면 어떻게해야합니까?Maven : 특정 폴더 이름으로 zip 이슈 압축을 풉니 다

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-dependency-plugin</artifactId> 
<version>2.4</version> 
<executions> 
    <execution> 
     <id>unpack-tomcat</id> 
     <phase>process-sources</phase> 
     <goals> 
      <goal>unpack</goal> 
     </goals> 
     <configuration> 
      <artifactItems> 
       <artifactItem> 
        <groupId>org.apache</groupId> 
        <artifactId>tomcat</artifactId> 
        <version>7.0.19-win64</version> 
        <type>zip</type> 
        <overWrite>false</overWrite> 
        <outputDirectory>tomcat</outputDirectory> 
        <excludes>webapps/**</excludes> 
       </artifactItem> 
      </artifactItems>        
     </configuration> 
    </execution> 
</executions> 
</plugin> 

답변

-2

사용 unpack-depencencies 목표와 false로 설정 useSubDirectoryPerArtifact.

+0

작동하지 않습니다. 이제는 단지 바람둥이를 걸러 낸 모든 종속성을 가져옵니다. – archmisha

+0

pom에있는 플러그인 선언의 구성 섹션에서 를 추가하십시오. BenjaminLinus

+0

전체 pom 플러그인 코드를 게시했습니다. 아직도 나를 위해 일하지 않습니다. 그냥 중첩 된 dir을 만듭니다 – archmisha

5

아마 내 제안을 달성 :) 아직 상황에 대한 해결 방법이 될 수 받는다는 개미 플러그인을 사용하여 더 많은 "mavenish"방법이 :

<plugin> 
    <artifactId>maven-antrun-plugin</artifactId> 
     <version>1.7</version> 
       <executions> 
        <execution> 
         <phase>package</phase> 
         <configuration> 
          <target> 
           <move file = "tomcat/apache-tomcat-7.0.19/*" 
             tofile = "tomcat" /> 
          </target> 
         </configuration> 
         <goals> 
          <goal>run</goal> 
         </goals> 
        </execution> 
        <execution> 
         <phase>package</phase> 
         <configuration> 
          <target> 
           <delete dir = "tomcat/apache-tomcat-7.0.19"/> 
          </target> 
         </configuration> 
         <goals> 
          <goal>run</goal> 
         </goals> 
        </execution> 
       </executions> 
</plugin> 
2

받는다는 플랫 경로를 풀고

http://pulkitsinghal.blogspot.com/2011/04/jetspeed-finally-unpack-plugin-with.html :

절대적이 받는다는 plugi를 얻을 수 (이 블로그 게시물 작성으로 나에게 알려져있는) 방법이 없습니다 플랫 구조로 침을 뱉어.

그래서 좋은 대안은 사용하는 것입니다 은 사용자가 포함 된 유물의 루트에서 상대 경로를하는 부담 없이 원하는 파일을 얻기 위해 configuration의 일환으로 <flat>true</flat>을 지정할 수 있습니다 jetspeed-unpack-maven-plugin 로 잘.

이 플러그인은 압축 된 메이븐 이슈 내부의 임의의 상대 경로를 특정 대상 폴더에 압축을 풀 수도 있습니다.