Maven Nexus 私有存储库访问

发布于 2025-01-04 03:01:10 字数 3765 浏览 1 评论 0原文

我刚刚在本地网络中设置了一个 Nexus 存储库。该存储库公开对 Maven 中央存储库以及三个不同的私有托管存储库的访问:snapshotreleaseext3rdparty。所有这些存储库都是 nexus 中公共组的一部分,我将其用作所有存储库的中央访问点:

http://nexus.server/nexus/content/groups/public/

我的问题是:使用NetBeans作为开发环境,我可以访问所有存储库除了ext3rdparty。即,当我尝试构建基于 ext3rdparty 存储库中存储的库的项目时,出现编译错误,并且 NetBeans 无法找到/导航此存储库中可用的任何工件。

我怀疑这是 settings.xml / pom.xml 问题,而不是 NetBeans 问题,因为正如我所说,我可以访问我在其他存储库中发布的工件,但我无法弄清楚问题出在哪里。

这是我的 settings.xml 的完整内容,用于将 maven 重定向到我自己的存储库:

<mirrors>
    <mirror>
        <id>nexus</id>
        <mirrorOf>*</mirrorOf>
        <url>http://nexus.server/nexus/content/groups/public</url>
    </mirror>
</mirrors>

<profiles>
    <profile>
        <id>nexus</id>
        <repositories>
            <repository>
                <id>central</id>
                <url>http://central</url>
                <releases>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <url>http://central</url>
                <releases>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>
</profiles>

<activeProfiles>
    <activeProfile>nexus</activeProfile>
</activeProfiles>

<servers>
    <server>
        <id>nexus</id>
        <username>user</username>
        <password>***</password>
    </server>
    <server>
        <id>releases</id>
        <username>user</username>
        <password>***</password>
    </server>
    <server>
        <id>snapshots</id>
        <username>user</username>
        <password>***</password>
    </server>
</servers>

这是我的父 pom 中与存储库相关的部分,以允许部署:

        <distributionManagement>
            <repository>
                <id>releases</id>
                <name>Releases</name>
                <url>http://nexus.server/nexus/content/repositories/releases/</url>
            </repository>

            <snapshotRepository>
                <id>snapshots</id>
                <name>Snapshots</name>
                <url>http://nexus.server/nexus/content/repositories/snapshots/</url>
            </snapshotRepository>
        </distributionManagement>

知道出了什么问题吗?

提前致谢!

编辑

浪费了半天的时间:我最终从 ext3rdparty 存储库中删除了所有依赖项,将它们再次上传到存储库,并更新了所有索引,现在一切正常

......真的知道这里出了什么问题,但至少 pom 和设置都没有问题。感谢您的帮助。

I have just set up a nexus repository in my local network. This repository exposes access to the Maven central repository, plus three different private hosted repositories: snapshot, release and ext3rdparty. All these repositories are part of the public group in nexus, which I use as a central access point for all repositories:

http://nexus.server/nexus/content/groups/public/

My problem is: Using NetBeans as development envirnment, I can access to all repositories except the ext3rdparty. i.e. i got a compilation error when I try to build projects which are based on libraries stored in the ext3rdparty repo, and NetBeans can't find / navigate any of the artifacts available in this repository.

I suspect this is a settings.xml / pom.xml problem and not a NetBeans one because as I said, I can access to artifacts that I've released in other repositories, but I can't figure-out what's the problem.

Here is the FULL content of my settings.xml to redirect maven to my own repository:

<mirrors>
    <mirror>
        <id>nexus</id>
        <mirrorOf>*</mirrorOf>
        <url>http://nexus.server/nexus/content/groups/public</url>
    </mirror>
</mirrors>

<profiles>
    <profile>
        <id>nexus</id>
        <repositories>
            <repository>
                <id>central</id>
                <url>http://central</url>
                <releases>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <url>http://central</url>
                <releases>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>
</profiles>

<activeProfiles>
    <activeProfile>nexus</activeProfile>
</activeProfiles>

<servers>
    <server>
        <id>nexus</id>
        <username>user</username>
        <password>***</password>
    </server>
    <server>
        <id>releases</id>
        <username>user</username>
        <password>***</password>
    </server>
    <server>
        <id>snapshots</id>
        <username>user</username>
        <password>***</password>
    </server>
</servers>

And here is the repositories-related part of my parent pom to allow deployment:

        <distributionManagement>
            <repository>
                <id>releases</id>
                <name>Releases</name>
                <url>http://nexus.server/nexus/content/repositories/releases/</url>
            </repository>

            <snapshotRepository>
                <id>snapshots</id>
                <name>Snapshots</name>
                <url>http://nexus.server/nexus/content/repositories/snapshots/</url>
            </snapshotRepository>
        </distributionManagement>

Any idea of what's wrong ?

Thanks in advance!

EDIT:

Half of a day lost: I finally ended up with removing all dependencies from the ext3rdparty repository, uploading them again to the repository, and updating all indexes and now everything works fine...

Don't really know what was the problem here, but at least the pom and the settings were OK. Thanks for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

|煩躁 2025-01-11 03:01:10

如果您遇到此类问题,您可以右键单击存储库列表中受影响的存储库并激活修复索引或更新索引,然后检查系统源中的系统更新状态。

If you have that sort of problem you can right click on the affected repository in the Repositories list and activate a Repair Index or Update Index and then check the status in the System Feeds for System updates.

み青杉依旧 2025-01-11 03:01:10

您是否将 ext3rdparty 存储库添加到您的公共组中?

公共存储库配置

Did you add your ext3rdparty repo to your public group?

public repo configuration

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文