nexus私服搭建及信息配置


nexus私服搭建及信息配置

下載

登錄nexus官網下載nexus安裝包https://help.sonatype.com/repomanager2/download/download-archives---repository-manager-oss

  • 我一開始在官網上沒有成功的將安裝包下載下來,所以使用的nexus的war包

啟動服務

  • 使用war包形式,將nexus的war包放在tomcat webapps目錄下,啟動tomcat即可。


訪問nexus服務

第一次訪問時,是匿名用戶登錄,只能看到部分權限,需要切換到admin用戶,默認密碼是admin123

setting.xml文件配置

<servers>
	<!-- 設置私庫認證信息(訪問) -->
	<server>
		<id>insuresmart-nexus</id>
		<username>admin</username>
		<password>admin123</password>
	</server>

	<!-- 設置私庫認證信息(發布) -->
	<server>
		<id>insuresmart-nexus-releases</id>
		<username>admin</username>
		<password>admin123</password>
	</server>
	
	<server>
		<id>insuresmart-nexus-snapshots</id>
		<username>admin</username>
		<password>admin123</password>
	</server>
</servers>

<!--設置私庫mirror 表示maven所有的請求都由nexus來處理 -->
	<mirror>
		<id>insuresmart-nexus</id>
		<name>Yitong Nexus Repository</name>
		<mirrorOf>*</mirrorOf>
		<url>http://localhost:8080/nexus/content/groups/public/</url>
	</mirror>
	
	<!--設置maven私庫信息 -->
	<profile>
		<id>insuresmart-nexus</id>
		<repositories>
			<repository>
				<id>insuresmart-nexus</id>
				<name>insuresmart nexus repository</name>
				<url>http://localhost:8080/nexus/content/groups/public/</url>
				<snapshots>
					<enabled>true</enabled>
				</snapshots>
				<releases>
					<enabled>true</enabled>
				</releases>
			</repository>
		</repositories>
		<pluginRepositories>
			<pluginRepository>
				<id>insuresmart-nexus</id>
				<name>insuresmart nexus repository</name>
				<url>http://localhost:8080/nexus/content/groups/public/</url>
				<snapshots>
					<enabled>true</enabled>
				</snapshots>
				<releases>
					<enabled>true</enabled>
				</releases>
			</pluginRepository>
		</pluginRepositories>
	</profile>
	
	<!--覆蓋maven中央倉庫設置開啟releases和snapshots版本的下載-->
	<profile>
		<id>central</id>
		<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>
	<activeProfile>insuresmart-nexus</activeProfile>
	<activeProfile>central</activeProfile>
</activeProfiles>

pom.xml文件配置

 <!--當前項目發布到遠程倉庫中-->
<distributionManagement>
    <repository>
        <id>insuresmart-nexus-releases</id>
        <name>insuresmart-nexus-releases</name>
        <url>http://localhost:8080/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>insuresmart-nexus-snapshots</id>
        <name>insuresmart-nexus-snapshots</name>
        <url>http://localhost:8080/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>

標簽id的值必須與setting文件中server標簽中的值一致。

	<server>
		<id>insuresmart-nexus-releases</id>
		<username>admin</username>
		<password>admin123</password>
	</server>
	
	<server>
		<id>insuresmart-nexus-snapshots</id>
		<username>admin</username>
		<password>admin123</password>
	</server>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM