If the built MAVEN project local repository does not have a corresponding dependency package, then it will go to the Nexus to download, then if the Nexus does not have this dependency package, go back to the Remote central repository download dependency, the Nexus download to the local MAVEN library for project reference.
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/8F/5F/wKioL1jcetqx8g7rAADmTRxSj4E202.png "title=" 1111. PNG "alt=" Wkiol1jcetqx8g7raadmtrxsj4e202.png "/>
Installation and configuration of the Maven Sonatype Nexus
1. Installation
1.1 Download Nexus(This is using: nexus-2.11.2-03-bundle.tar.gz)
http://www.sonatype.org/nexus/go/
1.2 Unzip: Because there are two folders after decompression, a new Nexus folder is created here.
[Email protected] opt]# mkdir nexus [[email protected] opt]# tar-zxvf/opt/tar/nexus-2.11.2-03-bundle.tar.gz-c/opt/ nexus/[[Email protected] opt]# CD nexus/[[email protected] nexus]# ls nexus-2.11.2-03 sonatype-work [email Protected] nexus]#
(A Nexus service, a private library directory)
1.3 Edit Nexus nexus.properties file, configure port and work directory information (leave default)
[email protected] conf]# cat nexus.properties
# Jetty Section application-port=8081 application-host=0.0.0.0 nexus-webapp=${bundlebasedir}/nexus nexus-webap P-context-path=/nexus # Nexus Section nexus-work=${bundlebasedir}/. /sonatype-work/nexus Runtime=${bundlebasedir}/nexus/web-inf
1.4 Edit Nexus Script
Vi/opt/nexus/nexus-2.11.2-03/bin/nexus #改成root Run_as_user=root
1.5 Start
/opt/nexus/nexus-2.11.2-03/bin/nexus start
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8F/5F/wKioL1jcg_CjeHftAAAXLrw1m9I466.png "title=" 1111. PNG "alt=" Wkiol1jcg_cjehftaaaxlrw1m9i466.png "/>
1.6 Visit : Http://192.168.175.9:8081/nexus
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8F/61/wKiom1jchDayPbUnAACbqMz44ns450.png "title=" 1111. PNG "alt=" Wkiom1jchdaypbunaacbqmz44ns450.png "/>
1.7 login, Default user name admin, default password admin123
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8F/61/wKiom1jcjN2DC722AAA-Lp4aAqg235.png "title=" 111. PNG "alt=" Wkiom1jcjn2dc722aaa-lp4aaqg235.png "/>
The Nexus is now complete and the Nexus configuration
2. Configuration (after login)
2.1 Menu Administration/server Configure the Mailbox service address (if you forgot your password, you can retrieve your password via this email)
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8F/61/wKiom1jckSDypBDdAADPNex0lAU494.png "title=" 1111. PNG "alt=" Wkiom1jcksdypbddaadpnex0lau494.png "/>
Test mailbox:
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8F/5F/wKioL1jckZbwF97zAAB8PEmMQm8073.png "title=" 1111. PNG "alt=" Wkiol1jckzbwf97zaab8pemmqm8073.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8F/5F/wKioL1jckbyR0eH-AAA2W3MnZic197.png "title=" 111. PNG "alt=" Wkiol1jckbyr0eh-aaa2w3mnzic197.png "/>
To configure the user email address, easy to forget the password back:
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8F/61/wKiom1jckpPwN8_VAAD_c1ggXSo162.png "title=" 111. PNG "alt=" Wkiom1jckppwn8_vaad_c1ggxso162.png "/>
2.2 Change Password
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/8F/61/wKiom1jckxShKkCNAABo9ecARJU871.png "title=" 111. PNG "alt=" Wkiom1jckxshkkcnaabo9ecarju871.png "/>
2.3 Warehouses
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8F/5F/wKioL1jck_6hIevtAAEbewluVcQ446.png "title=" 111. PNG "alt=" Wkiol1jck_6hievtaaebewluvcq446.png "/>
Group Warehouse Groups:
Nexus manages multiple warehouses centrally through the concept of warehouse groups, so that we can request warehouse groups directly in a project to request multiple warehouses managed by the Warehouse group
Hosted host repository:
Primarily used to publish internal project artifacts or third-party project artifacts (such as purchase of commercial artifacts) and artifacts that cannot be obtained from public warehouses (such as the JDBC Driver for Oracle)
Proxy Agent Warehouse:
Acting as a public remote repository;
Virtual Warehouse:
For use with Maven 1;
The general type of warehouse used is hosted, proxy.
Hosted warehouse common type description:
Releases: Release repository for the release module in the internal module
Snapshots: Publish the warehouse of the internal SNAPSHOT module
3rd parties: Third-party dependent warehouses, which are typically downloaded by internal personnel and published
If the built MAVEN project local repository does not have a corresponding dependency package, then it will go to the Nexus to download, if the Nexus does not have this dependency package, go back to the Remote central repository download dependency, these central warehouse is proxy. The Nexus download is successfully downloaded to the local MAVEN library for project reference.
Set proxy Agent repository (Apache Snapshots/central/codehaus snapshots) to allow remote download:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/8F/60/wKioL1jcl3HjyzM_AAGFCsJvgDU165.png "title=" 1111. PNG "alt=" Wkiol1jcl3hjyzm_aagfcsjvgdu165.png "/>
Note: Here are 3 proxy settings
Setting.xml configuration:
<?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>g:\workspace\maven_space</localrepository><interactivemode>true</ interactivemode><offline>false</offline> <plugingroups> </pluginGroups><!--Configure permissions to use the default user--><servers><server><id>nexus-releases</ Id><username>deployment</username><password>deployment123</password></server> <server> <id>nexus-snapshots</id><username>deployment</username>< password>deployment123</password></server>≪/servers> <mirrors> </mirrors> <profiles> <profile><id>edu</id><activation><activeByDefault>false</activeByDefault> <jdk>1.6</jdk></activation><repositories><!-- Private Library address warehouse Group--><repository> <id>nexus</id><url>http://192.168.175.9:8081/nexus/content/groups/public/</url>< releases><enabled>true</enabled></releases><snapshots><enabled>true</ enabled></snapshots></repository></repositories> < pluginrepositories><!--Plugin Library address--><pluginrepository><id>nexus</id><url>http:// 192.168.175.9:8081/nexus/content/groups/public/</url><releases><enabled>true</enabled> </releases><snapshots><enabled>true</enabled> </snapshots></ Pluginrepository></pluginrepositories></profile> </profiles><!--activating profile-->< Activeprofiles><activeprofile>edu</activeprofile></activeprofiles></settings>
Construction and release of the project: Pom.xml
<distributionmanagement><repository><id>nexus-releases</id><name>nexus Release Repository</name><url>http://192.168.175.9:8081/nexus/content/repositories/releases/</url> </repository><snapshotrepository><id>nexus-snapshots</id><name>nexus Snapshot Repository</name><url>http://192.168.175.9:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository></distributionManagement>
Publish to a private library:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/8F/62/wKiom1jcneqTej2gAACnLcYEy_4840.png "title=" 111. PNG "alt=" Wkiom1jcneqtej2gaacnlcyey_4840.png "/>
Pom:<version>1.0-snapshot</version>
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/8F/62/wKiom1jcoKviAOagAAFaElhwJjk151.png "title=" 111. PNG "alt=" Wkiom1jcokviaoagaafaelhwjjk151.png "/>
Pom:<version>1.0-releases</version>
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/8F/60/wKioL1jcoWeTTX2IAACIAmie1J8632.png "title=" 1111. PNG "alt=" Wkiol1jcowettx2iaaciamie1j8632.png "/>
4, upload third-party jar, such as: Demo.jar
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8F/61/wKioL1jcqIKhnVOhAAIS2hPzWys536.png "title=" 111. PNG "alt=" Wkiol1jcqikhnvohaais2hpzwys536.png "/>
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8F/63/wKiom1jcqMqQT6SaAABHACraw5E754.png "title=" 11. PNG "alt=" Wkiom1jcqmqqt6saaabhacraw5e754.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8F/61/wKioL1jcqRHzjxb9AAEbg55KwA0346.png "title=" 1111. PNG "alt=" Wkiol1jcqrhzjxb9aaebg55kwa0346.png "/>
Configure its boot start
1 , in charge of Nexus to/ETC/INIT.D
Cp/opt/nexus/nexus-2.11.2-03/bin/nexus/etc/init.d/nexus
2. Modify Nexus
[Email protected] ~]# vi/etc/init.d/nexusnexus_home= "/opt/nexus/nexus-2.11.2-03/"
3, modify the wrapper.conf
[Email protected] ~]# vi/opt/nexus/nexus-2.11.2-03/bin/jsw/conf/wrapper.conf wrapper.java.command=/home/jdk1.7.0_ 71/bin/java
4. Add Script executable permissions
chmod 755/etc/init.d/nexus
5. Add As System service
Chkconfig--add Nexus
This article is from "I Love Big gold" blog, please be sure to keep this source http://1754966750.blog.51cto.com/7455444/1911760
Linux Learning: Continuous integration--maven installation and configuration of private libraries and local libraries-03