【问题标题】:Maven. Snapshot updates (first download) don't work马文。快照更新(首次下载)不起作用
【发布时间】:2011-07-05 15:15:03
【问题描述】:

我从本地存储库创建了远程存储库(发布和快照)。两个新的远程存储库都添加了哟组/公共。 我尝试从头开始构建项目,但我的新本地仓库是空的。

在下载快照时出现以下错误:

[WARNING] The POM for net.homecredit.ws:integration.tests.base.ru:jar:1.0.0-SNAPSHOT is missing, no dependency information available

...

[ERROR] Failed to execute goal on project webclient-ru: Could not resolve dependencies for project net.company.ws:webclient-ru:jar:1.0.0-SNAPSHOT:

Could not find artifact net.company.ws:integration.tests.base.ru:jar:1.0.0-SNAPSHOT -> [Help 1]

存在问题快照的目录中的快照存储库中的 dir 命令输出:

Dir C:\Nexus\sonatype-work\nexus\storage\rep-snapshots\net\company\ws\integration.tests.base.ru\1.0.0-SNAPSHOT
28.02.2011  11:28    <DIR>          .
28.02.2011  11:28    <DIR>          ..
28.02.2011  11:28                 0 1
25.02.2011  11:50            15 551 integration.tests.base.ru-1.0.0-20100429-030459-1.jar
28.02.2011  11:19                32 integration.tests.base.ru-1.0.0-20100429-030459-1.jar.md5
28.02.2011  11:19                40 integration.tests.base.ru-1.0.0-20100429-030459-1.jar.sha1
25.02.2011  11:50             1 462 integration.tests.base.ru-1.0.0-20100429-030459-1.pom
28.02.2011  11:19                32 integration.tests.base.ru-1.0.0-20100429-030459-1.pom.md5
28.02.2011  11:19                40 integration.tests.base.ru-1.0.0-20100429-030459-1.pom.sha1
25.02.2011  11:50            15 551 integration.tests.base.ru-1.0.0-SNAPSHOT.jar
28.02.2011  11:19                32 integration.tests.base.ru-1.0.0-SNAPSHOT.jar.md5
28.02.2011  11:19                40 integration.tests.base.ru-1.0.0-SNAPSHOT.jar.sha1
25.02.2011  11:50             1 462 integration.tests.base.ru-1.0.0-SNAPSHOT.pom
28.02.2011  11:19                32 integration.tests.base.ru-1.0.0-SNAPSHOT.pom.md5
28.02.2011  11:19                40 integration.tests.base.ru-1.0.0-SNAPSHOT.pom.sha1
25.02.2011  18:26               794 maven-metadata.xml
28.02.2011  11:19                32 maven-metadata.xml.md5
28.02.2011  11:19                40 maven-metadata.xml.sha1

经过一些尝试后,我将两个可能的名称都放在了文件中。它们的内容是一样的。

maven 的我的 settings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <!-- localRepository
  | The path to the local repository maven will use to store artifacts.
  |
  | Default: ~/.m2/repository
    -->
    <localRepository>C:\Donz\Projects\Maven\repository</localRepository>
        <servers>
        <server>
            <id>hci-private-releases</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>hci-private-snapshots</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>thirdparty</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
    </servers>

    <profiles>
        <profile>
            <id>dev</id>
            <repositories>
                <repository>
                    <id>central</id>
                    <name>central</name>
                    <url>http://rep-pc.company.ru:8081/nexus/content/groups/public</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <updatePolicy>always</updatePolicy>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>public</id>
                    <name>Local repository for public group</name>
                    <url>http://rep-pc.company.ru:8081/nexus/content/groups/public</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <updatePolicy>always</updatePolicy>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>public-snapshots</id>
                    <name>Local repository for public snapshots group</name>
                    <url>http://rep-pc.company.ru:8081/nexus/content/repositories/rep-snapshots</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <updatePolicy>always</updatePolicy>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>hci-plugins-releases</id>
                    <name>Maven plugins repository</name>
                    <url>http://rep-pc.company.ru:8081/nexus/content/groups/public</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <updatePolicy>always</updatePolicy>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
                <pluginRepository>
                    <id>hci-plugins-snapshots</id>
                    <name>Maven plugins releases repository</name>
                    <url>http://rep-pc.company.ru:8081/nexus/content/repositories/rep-snapshots</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <updatePolicy>always</updatePolicy>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>

    <mirrors>
        <!-- mirror
        | Specifies a repository mirror site to use instead of a given repository. The repository that
        | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
        | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
        |
        -->
        <mirror>
          <id>central</id>
          <mirrorOf>central</mirrorOf>
          <name>nexus  repo</name>
          <url>http://rep-pc.company.ru:8081/nexus/content/groups/public</url>
        </mirror>
    </mirrors>
</settings>

maven 的控制台参数:

--no-plugin-registry --fail-fast --no-plugin-updates --strict-checksums \
--update-snapshots -s C:\Donz\Projects\Maven\settings.xml -f \
C:\Donz\Projects\WebClient\pom.xml install

快照存储库和组/公共的缓存、元数据、索引已过期、重建和更新。 Snapshot-repo 已重新启动。

如果我将丢失的快照文件放入本地 repo maven 不会报告任何错误。

从远程仓库下载快照有什么问题?

【问题讨论】:

  • 您是否有远程下载版本的问题(如果确实如此,那么您可能还没有连接到远程仓库)或者这个问题仅适用于快照(可能是快照仓库没有正确设置)?
  • 您是否检查过通过浏览器访问工件而不是查看文件系统?
  • 只有快照才有这个问题。而且我不知道我怎么会误认为快照存储库设置 - Nexus 中只有一个特定的快照设置(存储库类型)。是的,我通过浏览器检查了访问。没关系。

标签: java maven snapshot


【解决方案1】:

尝试在&lt;settings&gt; 元素中添加&lt;activeProfiles&gt;&lt;activeProfile&gt;dev&lt;/activeProfile&gt;&lt;/activeProfiles&gt;

【讨论】:

  • 也试试这个(我有这样的配置,一切正常(但我使用人工制品):&lt;repository&gt;&lt;id&gt;public-snapshots&lt;/id&gt;&lt;name&gt;Local repository for public snapshots group&lt;/name&gt;&lt;url&gt;http://rep-pc.company.ru:8081/nexus/content/repositories/rep-snapshots&lt;/url&gt;&lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;&lt;/repository&gt;
  • 感谢您的回答。不幸的是,我现在必须解决另一个问题。当我返回 set maven repo 时,我会尝试您的建议并在此处发布结果。
  • 是的,您的解决方案正是我所需要的!
猜你喜欢
  • 2015-02-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-07-27
  • 1970-01-01
相关资源
最近更新 更多