我已在我的全局m2设置中配置了我的组织正在使用的Nexus存储库。
在做mvn install
时,它会从Nexus Repo下载软件包,这表明配置正常。
然而,当在eclipse中使用maven时,似乎每当我执行Maven> Update Project,并且eclipse尝试下载在pom.xml中添加的新包时,它仍然从Maven Repo下载。
我已经配置了以下内容:
但是,我不确定为什么仍然没有从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>
使用像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>