【问题标题】:Maven: Package files generated during site lifecycle using Assembly pluginMaven:使用 Assembly 插件在站点生命周期中生成的包文件
【发布时间】:2013-04-19 15:11:07
【问题描述】:

我正在尝试打包一些在 maven 项目的 site life-cycle 期间生成的文件,以便我可以自动与使用它们的其他项目共享这些资源。

我已经成功地使用 maven 程序集插件来打包项目中已经存在的文件(在 /src/main/... 下),但是当我尝试将 /target/site/ 路径中的文件打包到 zip 中时,它总是最终为空。

POM.xml 看起来像这样

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <id>make shared resources</id>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <phase>package</phase>
                    <configuration>
                        <descriptors>
                            <descriptor>src/main/assembly/resources.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin>

程序集描述符

<assembly>
  <id>resources</id>
  <formats>
    <format>zip</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <fileSet>
      <directory>${project.build.directory}/site/</directory>
      <outputDirectory></outputDirectory>
    </fileSet>
  </fileSets>
</assembly>

我尝试将阶段更改为&lt;phase&gt;post-site&lt;/phase&gt;,但我感觉插件仅在默认生命周期中执行。

有什么办法吗?

【问题讨论】:

标签: xml maven maven-2 maven-assembly-plugin


【解决方案1】:

我想到的重要一点是:如果您有文件需要作为其他项目的依赖项,您必须在通常的生命周期而不是在 site 生命周期期间生成它们.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-14
    • 2012-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-02
    相关资源
    最近更新 更多