Sonatype Nexus Installation configuration see: Installing the Nexus in the CentOS system and importing the existing component libraries. The NEXUS has a built-in jetty container, and the ${NEXUS_HOME}/BIN/JSW directory contains startup scripts for each operating system. Of course, if you don't like the built-in jetty container, you can also download the Nexus War pack and deploy it in a container such as Tomcat.
After installing the deployment, it is important to be able to manage and configure it in depth, this article will introduce some advanced configuration techniques about the Sonatype nexus to facilitate configuration management. 1. Use Maven to upload components note The host type of warehouse is allowed to upload the component warehouse need to turn on the Allow upload function, configuration options in the deployment policy select "Let redeploy", see the following figure the Nexus user must have " Artifact Upload "privileges, nexus built in some role, such as" Nexus Deployment role ", you can upload components maven master configuration file needs to configure user information and upload the warehouse information, configuration examples are as follows:
<server>
<id>thirdparty</id>
<username>deployment</username>
< Password>password</password>
</server>
2. Modify the Listening port
By default, the Nexus listens on port 8081. You can change this port in the following ways. Stop Nexus Edit ${nexus_home}/conf/plexus.properties file, modify Applicationport value to restart Nexus. 3. Enable the Nexus to support packages in other formats
The Nexus default supports packages of Jar, war, Pom, EJB, ear, rar, par, etc., if you want to add some other types of packages, you can configure the following:
Add the configuration in the ${nexus-work}/conf/packaging2extension-mapping.properties configuration file:
My-custom-packaging=myextension |
If the profile does not exist, the file is created manually. 4. Update the warehouse index
1) Force Update Index
Nexus indexes often appear inconsistent with the remote warehouse index, causing some packages to not download properly, forcing the update of the warehouse index and keeping the index synchronized: Log in as Administrator right-click on the repository and select Expire Cache
Right click on the warehouse and select Update Index
2) timed update index log on to the left navigation bar as an administrator select Administration->scheduled Tasks
Click Add to add a scheduled task
Task type selection: Update repositories Index,repository/group Select the warehouse to update, recurrence Select the period type of the scheduled task 5, debug component download Process
If the Nexus Local index contains components but cannot be downloaded, the possible reasons are as follows: component libraries containing components are not in the group Type Component library route rules block download of components
The Nexus provides a way to debug the component download process, adding the parameter "? Describe" after the component's download path, as shown in the following example:
Http://192.168.120.202:8081/nexus/content/groups/public/org/codehaus/mojo/mojo-parent/30/mojo-parent-30.pom?describe
Http://localhost:8081/nexus/content/groups/public/foo/bar/1.0/bar-1.0.jar?describe
The Nexus will return the debug output as JSON, mainly including: whether the component's address component can be found and why, if the component can be found, the process of finding the component
The example returns the following results:
{"Data": {"Requesturl": "http://localhost:8081/nexus/content/groups/public/test/project/1.0/project-1.0". Jar?describe "," Processingtimemillis ": 471," request ": {" Requesturl ":" Http://localhost:8081/nexus /content/groups/public/test/project/1.0/project-1.0.jar?describe "," Requestpath ":"/test/project/1.0/projec T-1.0.jar "," RequestContext ": [" request.received.timestamp=1276286536595 "," request.addr ess=0:0:0:0:0:0:0:1%0 "," Request.remoteonly=false "," Request.url=http://localhost:8081/nexus/conte Nt/groups/public/test/project/1.0/project-1.0.jar?describe "," Request.localonly=false "," req Uest.approoturl=http://localhost:8081/nexus "]}," response ": {" Responsetype ":" Not_fou
ND "," processedrepositorieslist ": [" Public "," Snapshots "," thirdparty ",
"Central", "Java.net-m2", "java.net-m1-m2", "Google", "apache-snapshots", "Cod
Ehaus-snapshots "]," appliedmappings ": [" Public repository applied [11b647d6117038d8=
[Type=exclusion, Groupid=public, patterns=[.*/project/.*], mappedrepositories=[releases]] []} }
}
Note Look at the response node, as in the previous example, "Responsetype": "Not_found" means that the component is not found, which allows you to detail why the component cannot be downloaded.
Another example of a pom-type package "Mojo-parent-30.pom" is provided for debugging
{"Data": {"Requesturl": "Http://192.168.120.202:8081/nexus/content/groups/public/org/codehaus/mo
Jo/mojo-parent/30/mojo-parent-30.pom?describe "," Processingtimemillis ": 1322," request ": { "Requesturl": "Http://192.168.120.202:8081/nexus/content/groups/public/org/codehaus/mojo/mojo-parent/30/mojo-pa
Rent-30.pom?describe "," Requestpath ":"/org/codehaus/mojo/mojo-parent/30/mojo-parent-30.pom ",
"RequestContext": ["Request.remoteonly=false", "Request.localonly=true" ]}, "response": {"Responsetype": "FILE", "respon Seactualclass ":" Org.sonatype.nexus.proxy.item.DefaultStorageFileItem "," Responsepath ":"/groups/public/o Rg/codehaus/mojo/mojo-parent/30/mojo-parent-30.pom "," Responseuid ":" Central:/org/codehaus/mojo/mojo-pare Nt/30/mojo-parent-30.pom"," Originatingrepositoryid ":" Central "," originatingrepositoryname ":" Central ", "Originatingrepositorymainfacet": "Org.sonatype.nexus.proxy.maven.MavenProxyRepository", "Proce
Ssedrepositorieslist ": []," Properties ": [" created=1333560570000 ", "modified=1333560570000", "lastrequested=1375255131976", "remotechecked=137 5255131556 "," remoteurl=http://repo1.maven.org/maven2/org/codehaus/mojo/mojo-parent/30/mojo-parent-30 . Pom "," storedlocally=1375255131556 "," Isexpired=false "," R
Eadable=true "," Writable=true "," Virtual=false "], "Attributes": ["digest.md5=61a1f7765d45a51a6a7bb03bf410588f", "digest.sha1=b E742febdaa3cc7a971dacdf8cdc7ebd94b5765b "," remote.sha1=be742febdaa3cc7a971dacdf8cdc7ebd94b5765b "," Reque st.address=192.168.120.121 "," request.user=anonymous "," Storageitem-checkedremot ely=1375255131556 "," storageitem-created=1333560570000 "," Storageitem-expired=fa
LSE "," storageitem-generation=2 "," storageitem-lastrequested=1375255131976 ",
"storageitem-length=26627", "storageitem-modified=1333560570000", "Storageitem-path=/groups/public/org/codehaus/mojo/mojo-parent/30/mojo-parent-30.pom", "storageIt Em-readable=true "," storageitem-remoteurl=http://repo1.maven.org/maven2/org/codehaus/mojo/mojo-parent /30/mojo-parent-30.pom "," storageitem-repositoryid=central "," storageitem-stored locally=1375255131556 ",
"Storageitem-writable=true"}}}