`

NEXUS配置

 
阅读更多
	<mirrors>
...
		<mirror>
			<id>nexus</id>
			<mirrorOf>*</mirrorOf>
			<name>Nexus Mirror</name>
			<url>http://<Your Nexus IP>/nexus/content/groups/public</url>
		</mirror>
...
	</mirrors>
...
	<profiles>
		<profile>
			<id>nexus</id>
			<repositories>
				<repository>
					<id>nexus</id>
					<name>local private nexus</name>
					<url><Your Nexus IP>/nexus/content/groups/public</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</repository>
				<repository>
					<id>nexus</id>
					<name>local private nexus</name>
					<url>http://<Your Nexus IP>/nexus/content/groups/public-snapshots</url>
					<releases>
						<enabled>false</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
				</repository>

			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>nexus</id>
					<name>local private nexus</name>
					<url>http://<Your Nexus IP>/nexus/content/groups/public</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</pluginRepository>
				<pluginRepository>
					<id>nexus</id>
					<name>local private nexus</name>
					<url>http://<Your Nexus IP>/nexus/content/groups/public-snapshots</url>
					<releases>
						<enabled>false</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>
	</profiles>
...
	<activeProfiles>
		<activeProfile>nexus</activeProfile>
	</activeProfiles>

 在maven的配置文件即setting.xml文件中添加上面的代码配置依赖下载路径和发布路径

<project>  
...  
<distributionManagement>  
  <repository>  
    <id>nexus-releases</id>  
      <name>Nexus Release Repository</name>  
      <url>http://<Your Nexus IP>/nexus/content/repositories/releases/</url>  
  </repository>  
  <snapshotRepository>  
    <id>nexus-snapshots</id>  
    <name>Nexus Snapshot Repository</name>  
    <url>http://<Your Nexus IP>/nexus/content/repositories/snapshots/</url>  
  </snapshotRepository>  
</distributionManagement>  
...  
</project>  

 在项目的pom.xml文件中配置以上代码,指定发布到哪

<settings>  
...  
<servers>  
  <server>  
    <id>nexus-releases</id>  
    <username>admin</username>  
    <password>admin123</password>  
  </server>  
  <server>  
    <id>nexus-snapshots</id>  
    <username>admin</username>  
    <password>admin123</password>  
  </server>    
</servers>  
...  
</settings>  

 在maven配置文件中添加neuxs的用户名和密码

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

 如果要将源码一同发布到neuxs仓库中需在pom.xml文件中配置以上代码

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics