首页 > 系统服务 > 详细

linux部署安装maven私有库

时间:2017-01-10 00:10:27      阅读:444      评论:0      收藏:0      [点我收藏+]

linux部署安装maven私有库


1、先安装好jdk


2、下载sonatype Nexus

下载地址:http://pan.baidu.com/s/1dFJv5wl


3、在linux根目录下创建文件夹

# mkdir nexus


4、将安装包上传至linux系统上

上传至nexus文件夹内

# cd /nexus


5、解压Nexus

# tar zxvf nexus-2.14.2-01-bundle.tar.gz


6、会解压出2个文件夹

nexus-2.14.2-01(nexus服务,启动也是这个)

sonatype-work(私有库目录)


7、配置一下Nexus端口和启动参数

# cd /nexus/nexus-2.14.2-01/conf


# vi nexus.properties 

[root@localhost conf]# vi nexus.properties 
#
# Sonatype Nexus (TM) Open Source Version
# Copyright (c) 2008-present Sonatype, Inc.
# All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
#
# This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
# which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
#
# Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
# of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
# Eclipse Foundation. All other trademarks are the property of their respective owners.
#

# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus.

# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus

# Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF

# orientdb buffer size in megabytes
storage.diskCache.bufferSize=4096

application-port=8081(启动后访问的端口号,可以自行修改)

application-host=0.0.0.0(访问限制,0.0.0.0表示任何地址都可以访问)


我们保持默认不变,继续。。。


8、编辑nexus脚本,配置启动角色

# vi /nexus/nexus-2.14.2-01/bin/nexus 


默认是下面这一条:

# RUN_AS_USER=


修改成:

RUN_AS_USER=root


9、linux防火墙打开8081端口:

# vi /etc/sysconfig/iptables


添加一条:

-A INPUT -p tcp -m state --state NEW -m tcp --dport 8081 -j ACCEPT


重启防火墙:

# service iptables restart


10、启动nexus

# /nexus/nexus-2.14.2-01/bin/nexus start


11、访问Nexus


访问地址:http://192.168.226.130:8081/nexus



技术分享


Nexus刚启动的时候,有默认的帐号和密码,如果有需要可以自己去改


帐号:admin

密码:admin123



12、配置maven连接Nexus私有库


(maven安装和配置这里不详细介绍了)


首先配置一下maven本地库位置:

贴一下settings_dubbo.xml配置文件

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
	<localRepository>D:/apache-maven-3.3.9/.m2/repository</localRepository>
	<interactiveMode>true</interactiveMode>
    <offline>false</offline>
    <pluginGroups>
        <pluginGroup>org.mortbay.jetty</pluginGroup>
        <pluginGroup>org.jenkins-ci.tools</pluginGroup>
    </pluginGroups>
	
	<!--配置权限,使用默认用户-->
	<servers>
		<server>
			<id>nexus-releases</id>
			<username>deployment</username>
			<password>deployment123</password>
		</server>
		<server> 
			<id>nexus-snapshots</id>
			<username>deployment</username>
			<password>deployment123</password>
		</server>
	</servers>

    <mirrors>

    </mirrors>

	<profiles>
		<profile>
		   <id>edu</id>
			    <activation>
                    <activeByDefault>false</activeByDefault>
                    <jdk>1.7</jdk>
                </activation>
			    <repositories>
					<!-- 私有库地址-->
				    <repository>
						<id>nexus</id>
						<url>http://192.168.226.130:8081/nexus/content/groups/public/</url>
						<releases>
							<enabled>true</enabled>
						</releases>
						<snapshots>
							<enabled>true</enabled>
						</snapshots>
					</repository>
				</repositories>      
				<pluginRepositories>
					<!--插件库地址-->
					<pluginRepository>
						<id>nexus</id>
						<url>http://192.168.226.130:8081/nexus/content/groups/public/</url>
						<releases>
							<enabled>true</enabled>
						</releases>
						<snapshots>
							<enabled>true</enabled>
					   </snapshots>
					</pluginRepository>
				</pluginRepositories>
			</profile>
	</profiles>
	
	<!--激活profile-->
	<activeProfiles>
		<activeProfile>edu</activeProfile>
	</activeProfiles>
	
</settings>



上面配置完成之后,在配置一下eclipse里面的pom文件


<!-- 配置maven私有库地址 -->
	<distributionManagement>
		<repository>
			<id>nexus-releases</id>
			<name>Nexus Release Repository</name>
			<url>http://192.168.226.130:8081/nexus/content/repositories/releases/</url>
		</repository>
		<snapshotRepository>
			<id>nexus-snapshots</id>
			<name>Nexus Snapshot Repository</name>
			<url>http://192.168.226.130:8081/nexus/content/repositories/snapshots/</url>
		</snapshotRepository>
	</distributionManagement>


13、配置完成之后,开始使用Nexus私有库吧






















本文出自 “青葱岁月” 博客,请务必保留此出处http://alex233.blog.51cto.com/8904951/1890421

linux部署安装maven私有库

原文:http://alex233.blog.51cto.com/8904951/1890421

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!