使用 maven-release-plugin 部署程序集包 [英] Deploying assembly package with maven-release-plugin

查看:29
本文介绍了使用 maven-release-plugin 部署程序集包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用 Hudson 和 maven-release-plugin 来做发布版本.现在我有一个项目,其中包含一个 assembly ,它将所有需要的组件放在一起,然后将它们打包到具有所需目录结构的 .tar.gz 包中.

We use Hudson and the maven-release-plugin to do the release builds. Now I have a project which contains an assembly that puts together all needed components and then packages them into a .tar.gz package with the desired directory structure.

现在我正在尝试让 release-plugin 在发布期间将此包部署到我们的 Maven 存储库:执行目标,但只部署了标准的东西(源代码、javadoc、POM).

Now I'm trying to get the release-plugin to deploy this package to our Maven repository during the release:perform goal, but only the standard stuff (sources, javadoc, POM) are deployed.

我已经将汇编目标绑定到 maven 包阶段,并且 .tar.gz 在发布期间构建,但未上传到存储库.有什么提示我在这里做错了吗?

I've already bound the assembly goal to the maven package phase, and the .tar.gz gets build during the release, but not uploaded to the repository. Any hints what I'm doing wrong here ?

这是程序集插件配置:

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.2-beta-4</version>
    <configuration>
      <descriptors>
        <descriptor>src/main/assembly/distribution.xml</descriptor>
      </descriptors>
      <finalName>${pom.artifactId}-${pom.version}</finalName>
      <appendAssemblyId>false</appendAssemblyId>
      <tarLongFileMode>warn</tarLongFileMode>
    </configuration>
    <executions>
        <execution>
            <id>dist-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>assembly</goal>
            </goals>
        </execution>
    </executions>
</plugin>

我用来构建发布的命令是

The command I run to build a release is

mvn release:prepare release:perform release:clean

推荐答案

与此同时,我找到了两种方法来做我想做的事.

Meanwhile, I found 2 ways of doing what I wanted.

maven-build-helper-plugin 允许向应部署的工件列表添加其他条目:

The maven-build-helper-plugin allows to add additional entries to the list of artifacts that should be deployed:

    <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>build-helper-maven-plugin</artifactId>
         <version>1.3</version>
         <executions>
           <execution>
             <id>attach-distribution</id>
             <phase>package</phase>
             <goals>
               <goal>attach-artifact</goal>
             </goals>
             <configuration>
               <artifacts>
                 <artifact>
                   <file>target/${pom.artifactId}-${pom.version}.tar.gz</file>
                   <type>tar.gz</type>
                 </artifact>
               </artifacts>
             </configuration>
           </execution>
         </executions>
       </plugin>

另一个很简单,maven-user 邮件列表上的某个人指出了这一点.简单地使用 assembly:single 目标而不是 assembly:assembly.通过这种方式,生成的工件会在部署阶段上传到存储库.

The other is as simple as it gets and someone on the maven-user mailinglist pointed this out. Simple use the assembly:single goal instead of asssembly:assembly. This way the generated artifact is uploaded to the repository during the deploy phase.

    <execution>
        <id>dist-assembly</id>
        <phase>package</phase>
        <goals>
            <goal>single</goal> <!-- that's all :) -->
        </goals>
    </execution>

这篇关于使用 maven-release-plugin 部署程序集包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆