所以我的公司部署了一个内部maven存储库,我应该在内部下载所有内容,而不是从maven中央存储库下载。我正在设置repositories
这样的元素
<project>
<repositories>
<repository>
<id>Internal-maven-repo</id>
<name>Repo</name>
<url>http://build.a.com/nexus/content/groups/repo</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
因此,在执行maven package
时,是否需要在pom.xml
中指定存储库ID?我怎么知道它是从内部存储库下载而不是从外部下载?
答案 0 :(得分:1)
与关联repository manager looks like this关联的settings.xml
的正确配置:
<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>
有必要启用快照和发布。