用于缓存的 Maven 存储库服务器

Maven repository server for caching

我正在尝试了解有关 maven 的一些概念。这是我的场景: 几乎每次我部署一个项目,比如 Cloudstack,我都会输入:

mvn install

我遇到了一些失败,例如无法连接到某些存储库或某些测试刚刚失败。我不明白如果最近下载了代码,为什么有些测试会失败。

我的想法是创建一个本地服务器存储库,这样 Maven 就不会连接到远程服务器,而是连接到与应用程序所需的包位于同一网络中的服务器。

可以吗?还是这些问题是由其他原因造成的?

Maven, Introduction to Repositories:

There are strictly only two types of repositories: local and remote. The local repository refers to a copy on your own installation that is a cache of the remote downloads, and also contains the temporary build artifacts that you have not yet released.

Remote repositories refer to any other type of repository, [...]. These repositories might be a truly remote repository set up by a third party to provide their artifacts for downloading [...]. Other "remote" repositories may be internal repositories set up on a file or HTTP server within your company, used to share private artifacts between development teams and for releases.

mvn install 不部署 您项目的工件(至少不是 Maven 的 deploy,请参阅 Introduction to the Build Lifecycle)。它确实:

install the package into the local repository, for use as a dependency in other projects locally

mvn deploy 是:

done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects

无法连接到某些存储库”和“某些测试刚刚失败”是两种不同类型的错误。如果没有发生这些情况的构建输出的任何相关部分,就不可能说出更多信息。