开发者

Maven assembly plugin does not overwrite files during compile phase

开发者 https://www.devze.com 2023-03-01 02:34 出处:网络
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 wi

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 开发者_StackOverflow社区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.

0

精彩评论

暂无评论...
验证码 换一张
取 消