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

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

问题描述

我们使用Hudson和 maven-release-plugin 来执行发布版本。现在我有一个项目,其中包含一个装配,将所有需要的组件和然后将它们打包成具有所需目录结构的.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邮件列表中的某个人指出了这一点。简单的使用装配体:单个目标而不是asssembly: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天全站免登陆