Eclipse Maven没有从配置的Nexus存储库下载源和Javadoc

问题描述 投票:0回答:1

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

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

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

Downloading Sources from Central 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>
java eclipse maven nexus
1个回答
0
投票

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

<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>
© www.soinside.com 2019 - 2024. All rights reserved.