Maven assembly plugin does not overwrite files during compile phase

I have defined maven assembly plugin and have set pom to execute the plugin(assembly.xml) in "compile" phase. assembly.xml - it gets the jars/files using "dependencySet" and I replace few files with my local set using "fileSet".

With Maven assembly plugin 2.2 beta 2 it would replace the files. With version 2.2 or 2.2.1 of assembly plugin, a) it says "already added, skipping" and does not overwrite. b) if I modify the phase to "generate-resources" instead of "compile" in the pom, it shows the 'already added, skipping" message and anyways replaces/overwrites the files.

Would like to know, what has changed between versions and why the phase change would make it work. Also it would be helpful if someone can explain what exactly happens in "compile" phase (that it doesn't overwrite). Is there a workaround for my issue?

Thanks in advance for the help!

Included the snippet:

`<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-assembly-plugin</artifactId>
  <version>2.2</version>
  <executions>
    <execution>
      <id>create-install-image-layout</id>
      <phase>compile</phase>
      <goals>
        <goal>directory-single</goal>
      </goals>
      <configuration>
        <descriptors>
           <descriptor>src/main/assembly/assembly.xml</descriptor>                                              
        </descriptors>                                     
        <ignoreDirFormatExtensions>false</ignoreDirFormatExtensions>
      </configuration>
    </execution>
  </executions>
 </plugin>`

The goal directory-single is marked as deprecated. Furthermore the newest release of maven-assembly-plugin is 2.2.2 instead of 2.2. Furthermore to create an archive for any purpose the correct phase would be the package phase instead of the compiler phase where the compilation of the sources will be done.


What goal are you executing? Are you executing clean first? It may be skipping the compile phase because the code is already compiled.

链接地址: http://www.djcxy.com/p/29612.html

上一篇: 使用Maven Assembly插件排除依赖关系

下一篇: Maven程序集插件在编译阶段不会覆盖文件