Nexus和Maven:访问Maven Central Repo? [英] Nexus and Maven: Access to the Maven Central Repo?

查看:345
本文介绍了Nexus和Maven:访问Maven Central Repo?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Nexus和Maven时遇到了一些麻烦。
当我使用Nexus尝试使用Maven构建项目时,Maven无法找到任何工件。我将此添加到Maven设置:

I've got some trouble using Nexus and Maven. When I try to build projects with Maven using the Nexus, Maven is not able to find any artifact. I added this to the Maven Settings:

     <mirror>
       <id>nexus</id>
       <url>http://localhost:6060/nexus/content/groups/public</url>
       <mirrorOf>central</mirrorOf>
     </mirror>

将Maven连接到Nexus。
Maven中央仓库也在Nexus设置中定义

to connect Maven with the Nexus. The Maven central repo is also defined in the Nexus settings

推荐答案

根据 Nexus 您应该配置settings.xml文件,如下所示:

Based on the documentation of Nexus you should configure the settings.xml file like the following:

最重要的是, mirrorOf 只包含一个asterik以将所有请求重定向到已配置的Nexus实例。

The most important thing is that mirrorOf contains only an single asterik to get all request redirected to the configured Nexus instance.

<settings>
  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

这篇关于Nexus和Maven:访问Maven Central Repo?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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