If uploading on the windows command line:
You need to set it in the global setting.xml file:
setting The configuration is as follows: <?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>C:\Development\Library\Maven\repository\XHealthSystem-Dev</localRepository> <pluginGroups></pluginGroups> <proxies></proxies> <servers> <server> <!-- id You can write at will,,Corresponding to the id --> <id>maven-public</id> <!-- Login with user name and password --> <username>admin</username> <password>huanqiu888</password> </server> <server> <id>maven-snapshots</id> <username>admin</username> <password>huanqiu888</password> </server> </servers> <!--Requested download address,It's usually a central warehouse.--> <mirrors> <mirror> <id>mirrorId</id> <name>nexus</name> <url>http://47.166.191.218:8081/repository/maven-public/</url> <mirrorOf>*</mirrorOf> <!--Requested download address,It's usually a central warehouse.*All requests go private--> </mirror> </mirrors> <!--Requested download address,It's usually a central warehouse.--> <profiles> <profile> <id>nexus</id> <repositories> <repository> <id>nexus</id> <name>Nexus</name> <url>http://47.166.191.218:8081/repository/maven-releases/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus</id> <name>Nexus</name> <url>http://47.166.191.218:8081/repository/maven-snapshots/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> </settings>
Project code:
<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>com.jesse.test</groupId> <artifactId>project-c</artifactId> <version>0.0.1-SNAPSHOT</version> <!-- End of setting private server warehouse --> <!-- Test whether to download on Alibaba cloud or start downloading on private server --> <dependencies> <dependency> <groupId>antlr</groupId> <artifactId>antlr</artifactId> <version>2.7.7</version> </dependency> </dependencies> <!-- Test whether to download on Alibaba cloud or end downloading on private server --> <!-- Deploy remote management --> <distributionManagement> <!-- Release deployment --> <repository> <id>maven-public</id> <!-- this ID Must and setting.xml Medium id equally --> <name>Proj Release Repository</name> <url>http://47.166.191.218:8081/repository/maven-releases</url> <!-- Actual internal warehouse address --> </repository> <!-- Snapshot version deployment --> <snapshotRepository> <id>maven-snapshots</id> <!-- this ID Must and setting.xml Medium id equally --> <name>Proj Release snapshot</name> <url>http://47.166.191.218:8081/repository/maven-snapshots</url> <!-- Actual internal warehouse address --> </snapshotRepository> </distributionManagement> </project>
====
1.project-c is the package name of jar. Before publishing, you can search whether it exists.
2.mvn install
3.mvn deploy deployment
4. Check whether there is a package name with. project-c as jar in the remote warehouse. If so, the deployment is successful.
Pit: if an error is encountered, check the setting.xml configuration file. If the sub configuration file is configured, it may go to the general configuration file.