2016-09-28 43 views
0

Maven 3.我有以下捆綁zip文物。裏面有資源我想解壓縮並將這些資源複製到項目資源目錄中。maven神器複製文件夾從捆綁zip

我使用maven具組件插件

讚賞任何幫助創造了這個神器。

<dependency> 
    <groupId>org.frb.ny.mg.spatt.commons</groupId> 
    <artifactId>angular2-resources</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <classifier>bundle</classifier> 
    <type>zip</type> 
</dependency> 
+0

要解壓依賴項,可以參考http://stackoverflow.com/questions/5388661/unzip-dependency-in-maven。 – Tunaki

回答

1

您可以使用maven dependency unpack goal。例如:

<project> 
    [...] 
    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-dependency-plugin</artifactId> 
     <version>2.10</version> 
     <executions> 
      <execution> 
      <id>unpack</id> 
      <phase>package</phase> 
      <goals> 
       <goal>unpack</goal> 
      </goals> 
      <configuration> 
       <artifactItems> 
       <artifactItem> 
        <groupId>junit</groupId> 
        <artifactId>junit</artifactId> 
        <version>3.8.1</version> 
        <type>zip</type> 
        <overWrite>false</overWrite> 
        <outputDirectory>${project.build.directory}/../src/main/reseources</outputDirectory> 
        <includes>**/*.class,**/*.xml</includes> 
        <excludes>**/*test.class</excludes> 
       </artifactItem> 
       </artifactItems> 
       <includes>**/*.java</includes> 
       <excludes>**/*.properties</excludes> 
       <outputDirectory>${project.build.directory}/wars</outputDirectory> 
       <overWriteReleases>false</overWriteReleases> 
       <overWriteSnapshots>true</overWriteSnapshots> 
      </configuration> 
      </execution> 
     </executions> 
     </plugin> 
    </plugins> 
    </build> 
    [...] 
</project> 

請注意,其中一些配置是可選的。你可以刪除任何你不想要的東西。

相關問題