repo检查来自某个组的工件的更新

repo检查来自某个组的工件的更新

本文介绍了我怎样才能让Maven停止尝试从maven-central-repo检查来自某个组的工件的更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个相当大的Maven项目。我们可能有大约70个左右的单个工件,它们大致分为两个共享代码库,也许有十个使用它们的应用程序。所有这些项目都存在于命名空间 com.mycompany。*

I'm working on a fairly big Maven project. We have probably around 70 or so individual artifacts, which are roughly split into two libraries of shared code and maybe ten applications which use them. All of these items live in the namespace com.mycompany.*.

我们大多数时间都在运行针对快照构建。因此,为了完整构建应用程序,我可能首先构建库项目,以便将它们安装到我的本地存储库(例如, mycompany-libname-2.4-SNAPSHOT.jar )。

Most of the time we're running against snapshot builds. So to do a full build of an application, I might first build the library projects so that they are installed to my local repository (as, say, mycompany-libname-2.4-SNAPSHOT.jar).

问题在于,当我构建应用程序时。出于某种原因,Maven想检查主要的两个公共存储库(maven-net-repo和java-net-repo)以获取所有 mycompany的更新 - * - SNAPSHOT.jar 文物。当然,它们在那里找不到,所有的东西最终都会回到我刚建立到我本地存储库的版本,但是我希望Maven停止这样做,因为(a)它让我感觉像是一个糟糕的net.citizen为了不断检查这些存储库以寻找永远不会存在的东西,并且(b)它在我的构建过程中添加了一些不必要且烦人的网络延迟。

The problem is that when I then go build the applications. For some reason, Maven wants to check the main two public repositories (maven-net-repo and java-net-repo) for updates for all of the mycompany-*-SNAPSHOT.jar artifacts. Of course, they aren't found there, and everything eventually resolves back to the versions I just built to my local repository, but I'd like Maven to stop doing this because (a) it makes me feel like a bad net.citizen for constantly checking these repositories for things that will never be there, and (b) it adds some unnecessary and annoying network latency into my build process.

我已经接受了大多数时候在离线模式下运行maven来解决这个问题,但这并不理想,因为偶尔会更新对公共库的依赖。所以我正在寻找的是一个解决方案,它将导致Maven不检查来自给定存储库的更新是否符合某些标准的工件 - 在这种情况下,如果Maven忽略SNAPSHOT版本或其中的工件,我会很高兴 com.mycompany 命名空间。

I've taken to running maven in offline mode most of the time to work around this, but that's not ideal since occasionally a dependency on a public library will be updated. So what I'm looking for is a solution which will cause Maven not to check for updates from given repositories for artifacts which meet certain criteria - in this case, I'd be happy if Maven would ignore either SNAPSHOT versions or artifacts which were in the com.mycompany namespace.

推荐答案

updatePolicy标签没有为我工作。但Rich Seller提到应该禁用快照,所以我进一步观察并注意到我添加到settings.xml的额外存储库实际上导致了问题。在我的settings.xml中将快照部分添加到此存储库就行了!

The updatePolicy tag didn't work for me. However Rich Seller mentioned that snapshots should be disabled anyways so I looked further and noticed that the extra repository that I added to my settings.xml was causing the problem actually. Adding the snapshots section to this repository in my settings.xml did the trick!

<repository>
    <id>jboss</id>
    <name>JBoss Repository</name>
    <url>http://repository.jboss.com/maven2</url>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
</repository>

这篇关于我怎样才能让Maven停止尝试从maven-central-repo检查来自某个组的工件的更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 07:03