maven私服搭建

倖福魔咒の 提交于 2020-02-27 10:02:05
  • 私服环境搭建
  • 集成本地maven
    • 修改nexus默认密码
    • 更改配置
    [root[@localhost](https://my.oschina.net/u/570656) etc]# pwd
    /usr/local/jysemel/sonatype-work/nexus3/etc
    [root[@localhost](https://my.oschina.net/u/570656) etc]# 
    [root[@localhost](https://my.oschina.net/u/570656) etc]# 
    [root[@localhost](https://my.oschina.net/u/570656) etc]# 
    [root[@localhost](https://my.oschina.net/u/570656) etc]# cat nexus.properties 
    # Jetty section
    application-port=8081
    application-host=0.0.0.0
    # nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
    nexus-context-path=/nexus
    
    # Nexus section
    # nexus-edition=nexus-pro-edition
    # nexus-features=\
    #  nexus-pro-feature
    
    # nexus.hazelcast.discovery.isEnabled=true
    [root@localhost etc]# 
    
    • 更改maven setting文件
    <servers>
    	<server> 
    		<id>qg-Nexus</id>  
    		<username>admin</username>  
    		<password>9d276ebb-821b-4b2e-a5a2-6edda45c0be3</password>  
    	</server>
    </servers>
    
    <mirror>
    		<id>qg-Nexus</id>
    		<name>Nexus Mirror</name>
    		<url>http://192.168.30.114:8081/nexus/repository/maven-public/</url>
    		<mirrorOf>*</mirrorOf>
    	</mirror>
    	<mirror>
    		<id>nexus-aliyun</id>
    		<mirrorOf>central</mirrorOf>
    		<name>Nexus aliyun</name>
    		<url>http://maven.aliyun.com/nexus/content/groups/public</url> 
    	</mirror>
    
    <profile>
    		<activation>
    			<!-- 默认激活此 profile -->
    			<activeByDefault>true</activeByDefault>
    		</activation>
    		<repositories>
    			<repository>
    				<id>qg-Nexus</id>
    				<name>central</name>
    				<url>http://192.168.30.114:8081/nexus/repository/maven-public/</url>
    				<releases>
    					<enabled>true</enabled>
    				</releases>
    				<snapshots>
    					<enabled>true</enabled>
    				</snapshots>
    			</repository>
    		</repositories>
    		<pluginRepositories>
    			<pluginRepository>
    				<id>qg-Nexus</id>
    				<name>central</name>
    				<url>http://192.168.30.114:8081/nexus/repository/maven-public/</url>
    				<releases>
    					<enabled>true</enabled>
    				</releases>
    				<snapshots>
    					<enabled>false</enabled>
    				</snapshots>
    			</pluginRepository>
    		</pluginRepositories>
    	</profile>
    
    • 项目中pom配置
    <distributionManagement>
        <snapshotRepository>
            <id>qg-Nexus</id>
            <name>snapshot repository</name>
            <url>http://192.168.30.114:8081/nexus/repository/maven-snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>qg-Nexus</id>
            <name>releases repository</name>
            <url>http://192.168.30.114:8081/nexus/repository/maven-releases/</url>
        </repository>
    </distributionManagement>
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!