使用maven-release-plugin部署组装包
我们使用 Hudson 和 maven-release-plugin 来进行发布构建。现在我有一个项目,其中包含一个 程序集,它将所有需要的组件组合在一起,并且然后将它们打包成具有所需目录结构的 .tar.gz 包。
现在,我尝试获取发布插件,以在发布期间将此包部署到我们的 Maven 存储库:执行目标,但仅部署标准内容(源、javadoc、POM)。
我已经将程序集目标绑定到 Maven 包阶段,并且 .tar.gz 在发布期间构建,但未上传到存储库。有任何提示我在这里做错了什么吗?
这是程序集插件配置:
<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>
我运行来构建版本的命令是
mvn release:prepare release:perform release:clean
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.
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.
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 ?
Here is the assembly-plugin configuration:
<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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
同时,我找到了两种方法来做我想做的事。
maven-build-helper-plugin 允许向应部署的工件列表添加其他条目:
另一个非常简单,maven-user 邮件列表上的某人指出了这一点。简单地使用 assembly:single 目标而不是 assembly: assembly 。这样,生成的工件就会在部署阶段上传到存储库。
Meanwhile, I found 2 ways of doing what I wanted.
The maven-build-helper-plugin allows to add additional entries to the list of artifacts that should be deployed:
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.
部署文件不是发布插件的一部分,而是部署插件的一部分(发布本身不会在任何地方部署内容,但您可以配置在发布期间调用的部署插件)。
通常,部署插件会将所有工件部署到远程存储库,但程序集不是工件; Maven 无法以任何方式使用其存储库中的 .tar.gz 存档,因此首先部署它们是没有意义的。
如果你坚持将无用的文件复制到存储库中,则必须使用
deploy:deploy-file
(请参阅文档)手动部署文件并使用执行配置插件以在发布步骤中调用它。但我仍然建议不要这样做。您可能正在寻找一种自动将程序集上传到某处的方法。我不知道有哪个插件可以做到这一点。
Deploying files is not part of the release plugin but of the deploy plugin (release doesn't deploy stuff anywhere by itself but you can configure the deploy plugin to be called during a release).
Normally, the deploy plugin will deploy all artifacts to the remote repository but assemblies aren't artifacts; Maven can't use .tar.gz archives in its repository in any way, so it doesn't make sense to deploy them in the first place.
If you insist to copy useless files into the repository, you must use
deploy:deploy-file
(see the docs) to deploy a file manually and configure the plugin with an execution to invoke it during the release step. But I still advise against it.What you're probably looking for is a way to upload an assembly somewhere automatically. I'm not aware of a plugin that does this.