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

发布于 2024-11-03 03:44:36 字数 1259 浏览 6 评论 0原文

我已经定义了 Maven 程序集插件,并设置了 pom 在“编译”阶段执行插件(Assembly.xml)。 assembly.xml - 它使用“dependencySet”获取jar/文件,并且我使用“fileSet”将一些文件替换为我的本地集。

使用 Maven 程序集插件 2.2 beta 2 它将替换这些文件。 使用版本 2.2 或 2.2.1 的程序集插件, a) 它显示“已添加,正在跳过”并且不会覆盖。 b) 如果我将 pom 中的阶段修改为“生成资源”而不是“编译”,它会显示“已添加,正在跳过”消息,并且无论如何都会替换/覆盖文件。

想知道版本之间发生了什么变化以及为什么阶段改变会使其工作。如果有人可以解释“编译”阶段到底发生了什么(它不会覆盖),那也会很有帮助。 我的问题有解决方法吗?

预先感谢您的帮助!

包括片段:

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜无邪 2024-11-10 03:44:36

目标单一目录被标记为已弃用。此外,maven-assemble-plugin 的最新版本是 2.2.2,而不是 2.2。此外,为了任何目的创建存档,正确的阶段将是包阶段,而不是完成源代码编译的编译器阶段。

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.

谢绝鈎搭 2024-11-10 03:44:36

你正在执行什么目标?你首先执行干净吗?它可能会跳过编译阶段,因为代码已经编译。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文