2013-03-13 66 views
4

我有一個自定義artfiact類型web-module;只是一個ZIP,但有一個自定義的擴展名。Maven自定義歸檔擴展 - 如何使用解壓縮依賴項?

然後我有一個項目取決於它,我希望它的這種自定義類型的依賴項被解壓縮。該maven-dependency-pluginunpack-dependencies目標似乎符合這個要求,但我不斷收到錯誤:

[INFO] Unknown archiver type 
Embedded error: No such archiver: 'web-module'. 
[INFO] ------------------------------------------------------------------------ 
[INFO] Trace 
org.apache.maven.lifecycle.LifecycleExecutionException: Unknown archiver type 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719) 
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556) 
    ... 

我已經做了一些Googling和了解,我可以在我的自定義插件的的components.xml specifiy定製的取檔類型。在我components.xml中以下是現在:

<component> 
    <role>org.codehaus.plexus.archiver.UnArchiver</role> 
    <role-hint>web-module</role-hint> 
    <implementation>org.codehaus.plexus.archiver.zip.ZipUnArchiver</implementation> 
    <instantiation-strategy>per-lookup</instantiation-strategy> 
</component> 

一旦安裝我的自定義插件進行我再次嘗試,仍然沒有運氣!任何人都知道我要去哪裏錯了?

我也嘗試添加自定義擴展插件到錯誤模塊的POM與<extensions>true</extensions>

回答

0

試試這樣說:

<component-set> 
    <components> 
     <!-- Life-cycle mappings --> 
     <component> 
      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role> 
      <role-hint>web-module</role-hint> 
      <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation> 
      <configuration> 
       <phases> 
        <!-- You might need these as well. --> 
       </phases> 
      </configuration> 
     </component> 

     <!-- Artifact Handlers --> 
     <component> 
      <role>org.apache.maven.artifact.handler.ArtifactHandler</role> 
      <role-hint>web-module</role-hint> 
      <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> 
      <configuration> 
       <extension>web-module</extension> 
       <type>web-module</type> 
       <packaging>web-module</packaging> 
      </configuration> 
     </component> 
    </components> 
</component-set> 
相關問題