(i) download and install the Nexus
Nexus Just download the war package and put it on the Tomcat server.
(ii) Configure Nexus Repository
- Open Web Management interface: http://localhost:8081/nexus/index.html
- In the upper right corner, click Log in to login, default account: admin, Password: admin123
- Click Save, Download remote indexes=true, Configuration-------repositories, central warehouse, left, to download the index of the remote repository.
- Right-click central Warehouse, update index , updating the Remote Warehouse index to local, which accelerates the local index.
Description
- The new NEUXS environment is just an empty warehouse, need to manually and Remote Central Library synchronization, nexus by default is to turn off remote index download, the most important thing is to open the remote index download. Find the three warehouses on the right-hand warehouse list Apache Snapshots,codehaus snapshots and Maven Central, and then no warehouse configuration under the download Remote Indexes modified to True. Then right-click on each of the three warehouses and select Repari Index, so the nexus will download the remote index file. Right-click Warehouse, update index, updating the Remote Warehouse index to local, this step accelerates the local index .
- Create a new company's internal warehouse, step repositories–> add–> Hosted Repository, fill in the bottom half of the page with the Repository ID and Repository name in the input box, Also set deployment policy to allow redeploy
- The concept of the Warehouse Group in Nexus is not maven, in Maven's view, whether you are hosted or proxy, or group, for me is the same, I just according to Groupid,artifactid, Version and other information to you to the widget. To facilitate MAVEN configuration, the nexus can combine multiple warehouses, hosted or proxies into a group so that Maven relies on a group to use all the contents of the warehouse that the group contains.
(iii) configuration of Nexus Repository information in the project
Project Pom file configuration distributionmanagement
<distributionManagement> <repository> <id>releases</id> <name>nexus Release repository</name> <url>http://localhost:8081/nexus/content/repositories/releases/</ url> </repository> <snapshotRepository> <id>snapshots</id> < Name>nexus Snapshot repository</name> <url>http://localhost:8081/nexus/content/repositories/ Snapshots/</url> </snapshotRepository></distributionManagement>
settings.xml Configure the account password. Note The ID of the server must correspond to the ID of the repository
<Servers> <Server> <ID>Releases</ID> <username>Admin</username> <Password>Admin123</Password> </Server> <Server> <ID>Snapshots</ID> <username>Admin</username> <Password>Admin123</Password> </Server></Servers>
(iv) Release to Nexus Repository
- Project execution MVN Deploy, success is shown below
[INFO]---maven-deploy-plugin:2.7:deploy (default-deploy) @ tenpay---
Uploading:http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/1.2/tenpay-1.2.jar
Uploading:http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/1.2/tenpay-1.2.pom
Uploaded:http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/1.2/tenpay-1.2.pom (2 KB at 9.7 kb/sec)
Uploaded:http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/1.2/tenpay-1.2.jar (KB At 124.4 kb/sec)
Downloading:http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/maven-metadata.xml
Downloaded:http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/maven-metadata.xml (347 B at 4.3 kb/sec)
Uploading:http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/maven-metadata.xml
Uploaded:http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/maven-metadata.xml (376 B At 7.8 kb/sec)
[INFO]------------------------------------------------------------------------
[INFO] BUILD SUCCESS
http://my.oschina.net/xiaokaceng/blog/169530
MAVEN Project deployed to Nexus Repository