2013-05-08 45 views
1

使用maven-assembly-plugin我可以用我的項目特定需求創建一個* .jar。它解包所有依賴和傳遞依賴。但隨着我有一個第三方的jar,它不在maven倉庫中。這在我的項目中被本地引用。有沒有辦法指示maven-assembly-plugin解壓給定的jar文件呢?指示maven程序集插件解壓第三方jar沒有在pom.xml中定義爲依賴關係

我的罐子創建裝配描述是:

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> 
    <id>packing-jar</id> 
    <formats> 
    <format>jar</format> 
    </formats> 

    <includeBaseDirectory>false</includeBaseDirectory> 

    <fileSets> 
    <fileSet> 
     <directory>${project.build.outputDirectory}/com</directory> 
     <outputDirectory>/com</outputDirectory> 
    </fileSet> 
    </fileSets> 

    <dependencySets> 
    <dependencySet> 
     <outputDirectory>/</outputDirectory> 
     <unpack>true</unpack> 
     <useProjectArtifact>false</useProjectArtifact> 
    </dependencySet> 
    </dependencySets> 
</assembly> 
+0

看看這篇文章,這應該是一個可能的解決方案。 http://stackoverflow.com/questions/12298178/maven-depend-on-assembled-zip。如果您已經有答案,請發帖。 – GBP 2013-07-17 10:50:05

回答

0

由於我的要求需要解壓只有一個第三方的jar我想應該是一個轉機。使用maven install在本地安裝該jar。因此,該jar現在成爲maven依賴項的一部分,彙編插件將解壓縮它。