Din*_*esh 8 nexus sonatype maven
我们在Nexus中有多个存储库(即版本,快照和站点).所有3个存储库都在公共组下,用户使用相同的凭据访问所有这些存储库.在settings.xml中为每个存储库提供相同的用户名和密码会使其变得多余且难以维护.
您能否建议一种优雅的方式来描述所有3个存储库的一个服务器凭据?
任何帮助是极大的赞赏.
我们使用的是maven 2.2.1和Nexus OSS 2.7.1
这是我的settings.xml
<settings>
<servers>
<server>
<id>snapshot</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>release</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>site</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
<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>
Run Code Online (Sandbox Code Playgroud)
Man*_*ser 12
只需在setttings.xml中使用一个条目
<server>
<id>nexus</id>
<username>deployment</username>
<password>deployment123</password>
</server>
Run Code Online (Sandbox Code Playgroud)
然后在你的pom.xml中的distributionManagement中使用类似的东西
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Releases</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<name>Nexus Snapshot</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
Run Code Online (Sandbox Code Playgroud)
有关完整的工作设置,请查看试用指南中使用的Nexus Book Examples项目.当然,您也可以添加具有相同ID的网站.请记住,如果id; s与它们只是详细说明要查找的设置中的服务器元素的标识符并且不是存储库的id元素,则没有问题.Imho它应该被称为serverId或更清楚的东西,但这是一个不同的故事.
| 归档时间: |
|
| 查看次数: |
10992 次 |
| 最近记录: |