如何防止Maven检查外部存储库? [英] how to prevent maven from checking foreign repositories?

查看:96
本文介绍了如何防止Maven检查外部存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Maven进行构建时,我看到它检查了各种外部存储库中是否只有我的本地构建应产生的工件.我怎样才能说com.myorg组只能在本地存储库中找到?基本上,我想在工作空间分辨率上执行m2eclipse的功能,但是要在命令行上执行.

When I build using maven I see it checking all sort of foreign repositories for artifacts which only my local build should produce. How can I tell it that the com.myorg group can only be found in the local repository? Basically I want to do what m2eclipse does with workspace resolution but on the command line.

[INFO] snapshot com.myorg:core:0.0.1-SNAPSHOT: checking for updates from sun-jms
[INFO] snapshot com.myorg:core:0.0.1-SNAPSHOT: checking for updates from hibernate
[INFO] snapshot com.myorg:util:0.0.1-SNAPSHOT: checking for updates from sun-jms
[INFO] snapshot com.myorg:util:0.0.1-SNAPSHOT: checking for updates from hibernate
...

背景: 我有一个分层的Maven项目(一个级别).我想做一个完整的构建,所以我去到顶部做mvn clean install.

Background: I have a hierarchical maven project (one level). I want to do a full build so i go to the top and do mvn clean install.

  • com.myorg(父母)
    • pom.xml
    • com.myorg.core
      • pom.xml
      • com.myorg (parent)
        • pom.xml
        • com.myorg.core
          • pom.xml
          • pom.xml

          推荐答案

          如果您使用的远程存储库是发布存储库,并且实际上不包含任何SNAPSHOT,则可以为其禁用SNAPSHOT而且Maven不会检查它们的快照更新.例如:

          If the remote repositories that you are using are release repositories and do actually not contain any SNAPSHOT, they you can disable SNAPSHOT for them and Maven won't check them for SNAPSHOT updates. For example:

          <repositories>
            <repository>
              <id>java.net</id>
              <url>http://download.java.net/maven/2</url>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
            </repository>
            ...
          </repositories> 
          

          这篇关于如何防止Maven检查外部存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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