Maven manually upload the Jar package to the nexus private server command

1 Install the maven environment configuration on the local computer and run

mvn -version check if the installation is correct

2 Copy the package to be uploaded to the folder

3 Open a command window in the current folder

4 Run the maven upload jar package command (including release version and 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

Select the corresponding command configuration according to the version of the package to be uploaded

Maven's settings.xml file is attached

<?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>





Guess you like

Origin blog.csdn.net/Lixuanshengchao/article/details/80007101