【问题标题】:Eclipse Maven Not Downloading Sources and Javadoc from Configured Nexus RepositoryEclipse Maven 未从已配置的 Nexus 存储库下载源代码和 Javadoc
【发布时间】:2019-08-12 12:21:37
【问题描述】:

我已在我的全局 m2 设置中配置了我的组织正在使用的 Nexus 存储库。

在执行mvn install 时,它会从 Nexus Repo 下载软件包,这表明配置正常。

然而,当在 eclipse 中使用 maven 时,似乎每当我执行 Maven > Update Project 时,并且 eclipse 尝试下载添加到 pom.xml 中的新包,它仍在从 Maven Repo 下载。

我已经配置了以下内容:

  • 在 Preferences > Maven > Installations 下,这是指向我的 maven 文件
  • 在 Preferences > Maven > User Settings 下,这是指向我的用户文件夹下的 settings.xml 并配置到 nexus 存储库

但是,我不确定为什么仍然没有从 nexus repo 中检索到包。

我的 settings.xml

<settings>
<profiles>
    <profile>
        <id>MyId</id>
        <repositories>
            <repository>
                <id>MyRepo</id>
                <url>MyCompanysNexusRepoUrl</url>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>MyRepo</id>
                <url>MyCompanysNexusRepoUrl</url>
            </pluginRepository>
        </pluginRepositories>
    </profile>
</profiles>
<activeProfiles>
    <activeProfile>MyId</activeProfile>
</activeProfiles>
</settings>

【问题讨论】:

  • 请出示您的settings.xml....因为我认为它没有正确完成...
  • 感谢分享! @khmarbaise
  • 这正是我所期望的。看我的回答。

标签: java eclipse maven nexus


【解决方案1】:

settings.xml 用于使用像 Nexus 这样的存储库管理器应该如下所示:

<settings>
  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url> MyCompanysNexusRepoUrl</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>

【讨论】:

    【解决方案2】:

    如果您在有限制的网络中工作,您可能需要在 eclipse 中添加代理详细信息。

    【讨论】:

      猜你喜欢
      • 2013-06-09
      • 1970-01-01
      • 2017-12-21
      • 2018-01-12
      • 2021-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多