First of all, why build a maven, the simple point is that the project projects in the jar package on a server, each time the jar package modification can go down to local. Can form a unified management of the entire project team.
1. Download Nexus, Address: Http://www.sonatype.org/nexus/go
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/78/05/wKiom1ZzvEniXdk9AAK0o62zT9c996.png "title=" A.png " alt= "Wkiom1zzvenixdk9aak0o62zt9c996.png"/>
2, after downloading is this: 650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/78/05/wKiom1ZzvT3CJn9zAAAG2ir650Q246.png " Title= "B.png" alt= "wkiom1zzvt3cjn9zaaag2ir650q246.png"/> I This is the latest version of the current, downloaded after it can be uploaded to Linux, You can create a directory nexus in Linux first
# mkdir nexus# cd nexus# rz upload file # tar xzvf nexus-2.11.4-01-bundle.tar.gz
After unpacking, you will see two directories:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/78/05/wKiom1ZzvySB5gnhAAAIMslgtvQ508.png "title=" C.png " alt= "Wkiom1zzvysb5gnhaaaimslgtvq508.png"/>
NEXUS-2.11.4-01: Inside is the Nexus's operating environment and application
Sonatype-work: Inside is where we want to configure the nexus, such as indexing and starting warehouses and ports, can be configured here.
3. Start Nexus
# CD nexus-2.11.4-01/bin# LSJSW Nexus nexus.bat#./nexususage:./nexus {Console | start | stop | restart | status | dum P}#./nexus start****************************************warning–not RECOMMENDED to RUN as root********************** If you insist running as root and then set the environment variable run_as_user=root before running this SC Ript. Can not start, prompt this. Probably means to configure export run_as_user=root in the environment, the temporary configuration is entered at the command line: Export Run_as_user=root and then execute, no longer prompt./nexus start can also be permanently configured in the system VIM/ Etc/profile Join Export Run_as_user=root
Startup success:
#./nexus startstarting Nexus OSS ... Started Nexus oss.#./nexus consolerunning Nexus OSS ... Nexus OSS is already running.
To view logs:
# tail-f. /logs/wrapper.log
3. Page access: Http://youhostname:8081/nexus
See the following page:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/78/06/wKiom1ZzxIWDS-2LAAEMbopqmTU408.png "title=" D.png " alt= "Wkiom1zzxiwds-2laaembopqmtu408.png"/>
Note: The Nexus's default port is 8081 and can be modified later
Sign in with your default account and password
Account: admin
Password: admin123
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/78/06/wKiom1ZzxZLy72CjAAA4hwJZuQQ096.png "title=" E.png " alt= "Wkiom1zzxzly72cjaaa4hwjzuqq096.png"/>
After login
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/78/05/wKioL1Zzx0KDpsfaAAGitq4mmVI648.png "title=" F.png " alt= "Wkiol1zzx0kdpsfaaagitq4mmvi648.png"/>
3rd party, snapshots, releases these three, respectively, is used to hold the third parties jar, the project group internal Snapshot, the project group internal release version.
Configure the central warehouse to automatically update the index:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/78/05/wKioL1Zzx96x53ikAADsrPn1QYc249.png "title=" G.png " alt= "Wkiol1zzx96x53ikaadsrpn1qyc249.png"/>
4. Upload a third-party jar to the Nexus
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/78/07/wKiom1ZzyuTzhSVLAAHD53JsT2g296.png "title=" 1.png " alt= "Wkiom1zzyutzhsvlaahd53jst2g296.png"/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/78/07/wKiom1Zzyvyimu-YAAC-l8JO02c979.png "title=" 2.png " alt= "Wkiom1zzyvyimu-yaac-l8jo02c979.png"/>
Post-Upload search ...
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/78/05/wKioL1ZzyxShqPhQAACs72GccWw778.png "title=" 3.png " alt= "Wkiol1zzyxshqphqaacs72gccww778.png"/>
This makes the basic MAVEN Setup complete and uploads its own jar package.
Once the nexus has been built, there are times when the index is not updated due to network reasons, and here is a way to update the index offline.
Because there are no indexes and other jar packages inside the MAVEN, you need to overwrite the original index and warehouse with the MAVEN repository that you used to index and then upload to the Nexus.
First cover the warehouse bar, in fact, there is no order, you can first overwrite the index
Enter into the Sonatype-work/nexus/indexer directory, which is what the above said can be modified and configured on their own place.
# CD Sonatype-work/nexus/indexer # ls
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/78/07/wKiom1Zz0qKQmWZdAABQd_qcYU0008.png "title=" 0.png " alt= "Wkiom1zz0qkqmwzdaabqd_qcyu0008.png"/>
# CD: /indexer/central-ctx/
# ls
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/78/05/wKioL1Zz0R7zLNTsAABUMMOS9wg856.png "title=" L.png " alt= "Wkiol1zz0r7zlntsaabummos9wg856.png"/>
Upload your index and MAVEN repository to the corresponding location and reboot the Nexus.
#./nexus Restart
===========================================================
If you don't have an index on your hand, follow the steps to find the index you want:
First step: Download the index file
Nexus-maven-repository-index.gz
Nexus-maven-repository-index.properties
:
http://repo.maven.apache.org/maven2/.index/
Step two: Download the unzip tool
The following is to extract the index file, although the suffix is gz, but the decompression method is very special, we need to download a jar package: Indexer-cli-5.1.1.jar, we need to use this special jar to extract the index file
Note: Indexer-cli-5.1.1.jar is a tool dedicated to parsing and publishing indexes.
Fourth Step, cmd command decompression
Place the above three files (. gz &. Properties &. Jar) in the same directory, for example, I placed under the D:\index folder. Run the cmd command as follows:
A, positioning to the D:\index
D:
CD Index
B. Execute the decompression command
Java-jar indexer-cli-5.1.1.jar-u nexus-maven-repository-index.gz-d Indexer
After that, will automatically generate a indexer folder in the D:\index, about more than 10 minutes, the cmd command is completed, the indexer file size will reach 700M multipoint, and then the indexer files are copied to the "nexus-home}/" Sonatype-work/nexus/indexer/central-ctx directory, reboot Nexus, index update complete!
========================================================
When the index and MAVEN repository are passed on, restart the server to view the servers:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/78/08/wKiom1Zz2jmThex6AAFVZOYW1jY607.png "title=" M.png " alt= "Wkiom1zz2jmthex6aafvzoyw1jy607.png"/>
This article is from the "Simple Life" blog, so be sure to keep this source http://simplelife.blog.51cto.com/9954761/1726177
Using Nexus in Linux to build a maven