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>