来自捆绑zip的maven artifact copy文件夹

时间:2016-09-28 20:29:24

标签: maven maven-assembly-plugin

Maven 3.我有以下的捆绑拉链工件。 zip中有资源我要解压缩并将这些资源复制到项目资源目录中。

我使用maven-assembly-plugin

创建了这个工件

任何帮助表示感谢。

<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>

1 个答案:

答案 0 :(得分:1)

您可以使用maven dependency unpack goal。对于Eg:

<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>

请注意,其中一些配置是可选的。你可以删除任何你不想要的东西。