maven手动上传Jar包到nexus私服命令

1  在本地电脑安装maven环境配置,运行

mvn -version 检查是否正确安装成功

2 将要上传的包拷贝到文件夹中

3 在当前文件夹中打开命令窗口

4 运行maven上传jar包命令(包含release版本和snapshots)

mvn deploy:deploy-file -DgroupId=xxx.webgleaner -DartifactId=webgleaner-clound -Dversion=2.2.0-SNAPSHOT -Dpackaging=jar -Dfile=webgleaner-clound-2.2.0-SNAPSHOT.jar -Durl=http://nexus.xxx.com/content/repositories/snapshots -DrepositoryId=snapshots


mvn deploy:deploy-file -DgroupId=com.javacsv -DartifactId=csvreader -Dversion=2.1 -Dpackaging=jar -Dfile=csvreader-2.1.jar -Durl=http://nexus.xxx.com/content/repositories/releases -DrepositoryId=releases

根据要上传包的版本选择对应的命令配置

附 maven的settings.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">

  <activeProfiles>
    <activeProfile>aliyun-profile</activeProfile>
  </activeProfiles>

  <mirrors>
	<mirror>
 	<id>nexus-aliyun</id>
	<mirrorOf>*</mirrorOf>
	<name>Nexus aliyun</name>
	<url>http://106.75.152.xxx:8081/content/groups/public</url>
	</mirror>
  </mirrors> 

    <servers>
        <server>
            <id>releases</id>
            <username>deploy</username>
            <password>xxx</password>
        </server>
        <server>
            <id>snapshots</id>
            <username>admin</username>
            <password>xxx</password>
        </server>
    </servers>
<distributionManagement>  
  <repository>
    <id>releases</id>
	<name>releases</name>
    <url>http://106.75.152.xxx:8081/content/repositories/releases</url>
  </repository>
  <snapshotRepository>
    <id>snapshots</id>
	<name>snapshots</name>
    <url>http://106.75.152.xxx:8081/content/repositories/snapshots</url>
  </snapshotRepository> 
</distributionManagement>
  

  <profiles>
    <profile>
      <id>aliyun-profile</id>
      <properties>
        <encoding>UTF-8</encoding>
        <project.build.sourceEncoding>${encoding}</project.build.sourceEncoding>
        <project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding>
      </properties>
      <repositories>
	<repository>
	<id>nexus</id>
	<name>local private nexus</name>
	<url>http://106.75.152.xxx:8081/content/groups/public</url>
		<releases>
			<enabled>true</enabled>
		</releases>
		<snapshots>
			<enabled>true</enabled>
		</snapshots>
		</repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>  
			<id>nexus</id>
			<name>local private nexus</name>
			<url>http://106.75.152.xxx:8081/content/groups/public</url>
			<releases>
			<enabled>true</enabled>
			</releases>
			<snapshots>
			<enabled>true</enabled>
			</snapshots>
		</pluginRepository>
      </pluginRepositories>
    </profile>
	<profile>
		<id>jdk-1.8</id>
		<activation>
			<activeByDefault>true</activeByDefault>
			<jdk>1.8</jdk>
		</activation>
		<properties>
			<maven.compiler.source>1.8</maven.compiler.source>
			<maven.compiler.target>1.8</maven.compiler.target>
			<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
		</properties>
	</profile>
  </profiles>
  

</settings>





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

月夜归醉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值