2012-01-19 14 views
9

tomcat zip artifactをダウンロードしてtomcatという名前のフォルダに展開しようとしています。 私が得るものは、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のプラグイン宣言の設定セクションの下に tomcat BenjaminLinus

+0

を追加しました.pomプラグインコード全体を投稿しました。それはまだ私のために働かない。ネストされたディレクトリを作成する – archmisha

5

はたぶん私の提案を達成:)まだあなたの状況の回避策可能性のmavenアリプラグインを使用するための、より「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

Mavenのは、フラットパスで解凍

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

絶対にこのMavenのplugiを取得するには (このブログの記事の書き込みのように私に知られている)方法はありませんフラットな構造を吐き出すためにn。

はとても良い代替手段は使用することである ユーザーが含まれるアーチファクトのルートからの相対パスを有する負担 ことなく、所望のファイルを得るために configurationの一部として<flat>true</flat>を指定することができjetspeed-unpack-maven-plugin と同様です。

このプラグインは、ZipされたMavenアーティファクト内の任意の相対パスを特定の保存先フォルダに解凍することもできます。

関連する問題