"mvn deploy"和"mvn deploy"之间有什么区别?到本地存储库并进行"MVN安装"? [英] What is the difference between "mvn deploy" to a local repo and "mvn install"?

查看:396
本文介绍了"mvn deploy"和"mvn deploy"之间有什么区别?到本地存储库并进行"MVN安装"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队使用内部团队Maven存储库,该存储库是使用Apache从开发服务器共享的.我们还在同一台计算机上运行Continuum CI服务器. Continuum中的Maven构建以安装"目标运行,该目标将最终工件直接复制到共享目录中.

My team uses an internal team maven repo that is shared from a development server using Apache. We also run the Continuum CI server on the same machine. Maven builds in Continuum are run with the "install" goal, which copies the final artifact directly into the shared directory.

问题是,使用mvn install将文件添加到共享存储库和使用部署目标(mvn-deploy插件)之间有什么区别?

The question is, what is the difference between adding files to the shared repo using mvn install and using the deploy goal (mvn-deploy plugin)?

在我看来,使用mvn deploy会带来额外的配置麻烦,但是我读到某处由于某种原因而将文件安装到共享存储库中是一个坏主意,这与maven的内部工作相关.

It seems to me that using mvn deploy creates additional configuration hassles, but I have read somewhere that installing files into a shared repo is a bad idea for some reason related to the internal workings of maven.

更新:我得到了部署和安装之间的功能差异;实际上,对于在Maven存储库中创建哪些文件的底层细节更感兴趣.

update: I get the functional differences between deploy and install; I am actually more interested in the low level details in terms of what files are created in the maven repo.

推荐答案

肯,很好的问题.在权威指南中,我应该更加明确区别. 安装"和部署"在构建中有两个不同的用途. 安装"是指在本地存储库中安装工件的过程. 部署"是指将工件部署到远程存储库的过程.

Ken, good question. I should be more explicit in the The Definitive Guide about the difference. "install" and "deploy" serve two different purposes in a build. "install" refers to the process of installing an artifact in your local repository. "deploy" refers to the process of deploying an artifact to a remote repository.

示例:

  1. 当我在计算机上运行大型多模块项目时,通常将运行"mvn install".这将在本地存储库中安装所有生成的二进制软件工件(通常是JAR).然后,当我在构建中构建各个模块时,Maven将从本地存储库中检索依赖项.

  1. When I run a large multi-module project on a my machine, I'm going to usually run "mvn install". This is going to install all of the generated binary software artifacts (usually JARs) in my local repository. Then when I build individual modules in the build, Maven is going to retrieve the dependencies from the local repository.

当需要部署快照或发行版时,我将运行"mvn deploy".运行此命令将尝试将文件部署到远程存储库或服务器.通常,我将部署到存储库管理器,例如 Nexus

When it comes time to deploy snapshots or releases, I'm going to run "mvn deploy". Running this is going to attempt to deploy the files to a remote repository or server. Usually I'm going to be deploying to a repository manager such as Nexus

的确,运行部署"将需要一些额外的配置,您将必须在POM中提供一个distributionManagement部分.

It is true that running "deploy" is going to require some extra configuration, you are going to have to supply a distributionManagement section in your POM.

这篇关于"mvn deploy"和"mvn deploy"之间有什么区别?到本地存储库并进行"MVN安装"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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