maven--Setup (Nexus use)

Source: Internet
Author: User

Nexus Common features are: Specify the central address of the IP, assign your MAVEN project to the address, download the project index from the Central Library, download the dependent component from the repository, and upload the third-party project Jar to the other project group.

After turning on the Nexus service to access the URL address http://localhost:8081/nexus/(recommended to use their own IP address), and then login to the system, the user name password is: admin/admin123.

The most frequent is to click the Repositories button on the left menu bar



Group Warehouse Groups: Nexus manages multiple warehouses with the concept of a warehouse group, so that we request warehouse groups directly in the project to request multiple warehouses managed by the Warehouse group;


Hosted host repository: primarily for publishing 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: Agent of the public remote warehouse;

Virtual Warehouse: Used to fit Maven 1;

The general type of warehouse used is hosted, proxy

Hosted Warehouse Common Type description:

Release repository for the release module in the releases internal module

Snapshots Release the warehouse of the internal SNAPSHOT module

3rd The third party relies on the warehouse, this data is usually downloaded by the internal personnel after the release

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.

1, set proxy Agent warehouse (Apache Snapshots/central/codehaus snapshots) to allow remote download,

Other two agent libraries are also set to True

Installation and configuration of 2.Maven local libraries Setting.xml

[HTML]View Plain Copy
  1. <?xml version= "1.0" encoding= "UTF-8"?>
  2. <settings xmlns= "http://maven.apache.org/SETTINGS/1.0.0"
  3. Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemalocation= "http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" >
  5. <localRepository>D:/maven/repository</localRepository>
  6. <interactiveMode>true</interactiveMode>
  7. <offline>false</offline>
  8. <pluginGroups>
  9. <pluginGroup>org.mortbay.jetty</pluginGroup>
  10. <pluginGroup>org.jenkins-ci.tools</pluginGroup>
  11. </pluginGroups>
  12. <!--Configure permissions, use Default User--
  13. <servers>
  14. <server>
  15. <id>nexus-releases</id>
  16. <username>deployment</username>
  17. <password>deployment123</password>
  18. </server>
  19. <server>
  20. <id>nexus-snapshots</id>
  21. <username>deployment</username>
  22. <password>deployment123</password>
  23. </server>
  24. </servers>
  25. <mirrors>
  26. </mirrors>
  27. <profiles>
  28. <profile>
  29. <id>nexus</id>
  30. <activation>
  31. <activeByDefault>false</activeByDefault>
  32. <jdk>1.7</jdk>
  33. </activation>
  34. <repositories>
  35. <!--Private library address--
  36. <repository>
  37. <id>nexus</id>
  38. <url>http://127.0.0.1:1818/nexus/content/groups/public/</url>
  39. <releases>
  40. <enabled>true</enabled>
  41. </releases>
  42. <snapshots>
  43. <enabled>true</enabled>
  44. </snapshots>
  45. </repository>
  46. </repositories>
  47. <pluginRepositories>
  48. <!--plugin Library address--
  49. <pluginRepository>
  50. <id>nexus</id>
  51. <url>http://127.0.0.1:1818/nexus/content/groups/public/</url>
  52. <releases>
  53. <enabled>true</enabled>
  54. </releases>
  55. <snapshots>
  56. <enabled>true</enabled>
  57. </snapshots>
  58. </pluginRepository>
  59. </pluginRepositories>
  60. </profile>
  61. </profiles>
  62. <!--activating profile-->
  63. <activeProfiles>
  64. <activeProfile>nexus</activeProfile>
  65. </activeProfiles>
  66. </settings>
  67. <span style= "font-family:arial, Helvetica, Sans-serif;" ><span style= "White-space:normal;" >
  68. </span></span>

3. Publish the project to a

Pom.xml Adding a configuration

[HTML]View Plain Copy
  1. <distributionManagement>
  2. <repository>
  3. <id>nexus-releases</id>
  4. <name>nexus Release repository</name>
  5. <url>http://127.0.0.1:1818/nexus/content/repositories/releases/</url>
  6. </repository>
  7. <snapshotRepository>
  8. <id>nexus-snapshots</id>
  9. <name>nexus Snapshot repository</name>
  10. <url>http://127.0.0.1:1818/nexus/content/repositories/snapshots/</url>
  11. </snapshotRepository>
  12. </distributionManagement>

Then run the Publish

Clean Deploy

After the console has been published successfully

Then go to the warehouse on the database and see if there is a project just released.

4. Upload a third-party jar package

Then click the Select Artifact (s) for upload button to select the jar package to upload, then add arifact

Last point Upload Artifact (s)

View after successful upload

Reference

http://blog.csdn.net/xiaoreqing/article/details/51352751

Http://www.cnblogs.com/luotaoyeah/p/3817465.html

maven--Setup (Nexus use)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.