Eclipse中安装新的repository库,并本地库jar上传nexus中

1、下载 apache-maven-3.0.5-bin.zip 

2、解压后:F:\SVN\apache-maven-3.0.5 ;

3、配置【系统变量】:

M2_HOME

F:\SVN\apache-maven-3.0.5


配置用户变量

path

%M2_HOME%\bin;


4、输入 【mvn -v】,查看配置是否成功;


5、配置setting.xml文件   F:\SVN\apache-maven-3.0.5\.m2\repository\setting.xml  文件中,添加新想  仓库 路径,如下。

 内容如下:注意用户、密码 的 【ID】

<?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>F:/SVN/apache-maven-3.0.5/.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>zuk</id>
			    <activation>
                    <activeByDefault>false</activeByDefault>
                    <jdk>1.6</jdk>
                </activation>
			    <repositories>
					<!-- 私有库地址-->
				    <repository>
						<id>nexus</id>
						<url>http://192.168.1.250: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.1.250:8081/nexus/content/groups/public/</url>
						<releases>
							<enabled>true</enabled>
						</releases>
						<snapshots>
							<enabled>true</enabled>
					   </snapshots>
					</pluginRepository>
				</pluginRepositories>
			</profile>
	</profiles>
	
	<!--激活profile-->
	<activeProfiles>
		<activeProfile>zuk</activeProfile>
	</activeProfiles>
	
</settings>

注意用户权限配置的 id 与要pom.xml文件中的配置一致;

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  	<groupId>zuk.all.parent</groupId>
  	<artifactId>zuk-all-parent</artifactId>
  	<version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>

	<properties>  
	    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
	</properties>  
    
    <!--运行 mvn deploy 时上传构件到本地仓库 -->
    <distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <name>Nexus Release Repository</name>
            <url>http://192.168.1.250:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>nexus-snapshots</id>
            <name>Nexus Snapshot Repository</name>
            <url>http://192.168.1.250:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>	

	<dependencies>
	    <dependency>
	      	<groupId>junit</groupId>
	      	<artifactId>junit</artifactId>
	      	<version>3.8.1</version>
	      	<scope>test</scope>
	    </dependency>
	</dependencies>
	
</project>



6、在Eclipse中配置新的  仓库  路径;




7、上传本地pom、jar、war包到nexus中;

maven项目-》Run as -》Run configurations


8、

查看 console 是否成功、查看 nexus 中是否上传成功。


  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值