1. upload via webpage
This method only uploads the jar package. You cannot obtain jar Dependencies by referencing the current jar through Maven.
From pom, select the POM file and jar. When jar is introduced through Maven, the jar dependency is automatically loaded.
2. depoly through Maven
InMaven CONF/setting. xmlConfigure the management account of the nexus private server
Add Server under the servers label
<server> <id>nexus-snapshots</id> <username>repouser</username> <password>repopwd</password> </server>
ID: You can define a name and the password of the Administrator account of the private server.
Configure the Nexus private server under mirrors and profiles
<mirrors> <mirror> <!--This sends everything else to /public --> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://192.168.10.8:18080/nexus/content/repositories/releases/</url> </mirror> </mirrors> <profiles> <profile> <id>nexus</id> <!--Enable snapshots for the built in central repo to direct --> <!--all requests to nexus via the mirror --> <repositories> <repository> <id>nexus</id> <name>local private nexus</name> <url>http://192.168.10.8:18080/nexus/content/groups/public</url> <releases><enabled>true</enabled><updatePolicy>always</updatePolicy> <checksumPolicy>warn</checksumPolicy></releases> <snapshots><enabled>false</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus</id> <name>local private nexus</name> <url>http://192.168.10.8:18080/nexus/content/groups/public</url> <releases><enabled>true</enabled><updatePolicy>always</updatePolicy> <checksumPolicy>warn</checksumPolicy></releases> <snapshots><enabled>false</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <!--make the profile active all the time --> <activeProfile>nexus</activeProfile> </activeProfiles>
Configure in POM. xml of the project
<distributionManagement> <repository> <id>nexus-releases</id> <name>Nexus Release Repository</name> <url>http://192.168.10.8:18080/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>nexus-snapshots</id> <name>Nexus Snapshot Repository</name> <url>http://192.168.10.8:18080/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>
ID corresponds to the server ID in settings. xml
After the project package
mvn deploy
You can upload the jar to the nexus private server.