PW connection configuration maven

Two ways:

1. In connection address PW pom.xml single item, so that only work on the project.

2. Add the connection address PW setting.xml configuration of maven. This is for all projects.

This article demonstrates only the second method:

1. Make sure the nexus PW installation and startup.

2. modify the configuration files in native maven / conf / setting.xml.

Complete the following:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  6. // maven repository location
  7. <localRepository>D:\MAVEN_repository</localRepository>
  8.  
  9. <pluginGroups> </pluginGroups>
  10.  
  11. <proxies> </proxies>
  12. // set permissions maven operation nexus
  13. </servers>
  14. <server>
  15. <id>nexus-releases</id>
  16. <username>admin</username>
  17. <password>admin123</password>
  18. </server>
  19. <server>
  20. <id>nexus-snapshots</id>
  21. <username>admin</username>
  22. <password>admin123</password>
  23. </server>
  24. <server>
  25. <id>3rd-proty</id>
  26. <username>admin</username>
  27. <password>admin123</password>
  28. </server>
  29. </servers>
  30. // configure a mirror, so only use maven get PW
  31. <mirrors>
  32. <mirror>
  33. <id>nexus</id>
  34. <name>Nexus Repository</name>
  35. <url>http://10.0.27.61:8081/content/groups/public</url>
  36. <mirrorOf>*</mirrorOf>
  37. </mirror>
  38. </mirrors>
  39. // Configure storage vehicles plugin Once you have configured mirroring, you can ignore this configuration
  40. <profiles>
  41. <profile>
  42. <id>nexus</id>
  43. <repositories>
  44. <repository>
  45. <id>nexus</id>
  46. <url>http://10.0.27.61:8081/content/groups/public</url>
  47. <releases>
  48. <enabled>true</enabled>
  49. </releases>
  50. <snapshots>
  51. <enabled>true</enabled>
  52. </snapshots>
  53. </repository>
  54. </repositories>
  55. <pluginRepositories>
  56. <pluginRepository>
  57. <id>nexus</id>
  58. <url>http://10.0.27.61:8081/content/groups/public</url>
  59. <releases>
  60. <enabled>true</enabled>
  61. </releases>
  62. <snapshots>
  63. <enabled>true</enabled>
  64. </snapshots>
  65. </pluginRepository>
  66. </pluginRepositories>
  67. </profile>
  68. </profiles>
  69. // activate the above configuration
  70. <activeProfiles>
  71. <activeProfile>nexus</activeProfile>
  72. </activeProfiles>
  73.  
  74. </settings>

Guess you like

Origin www.cnblogs.com/zhuyeshen/p/11428896.html