pom文件右键,选择“open settings.xml”或者 “create settings.xml”
    image.png

    复制下方代码,重启Idea

    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. <mirrors>
    6. <!-- mirror
    7. | Specifies a repository mirror site to use instead of a given repository. The repository that
    8. | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
    9. | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
    10. |
    11. <mirror>
    12. <id>mirrorId</id>
    13. <mirrorOf>repositoryId</mirrorOf>
    14. <name>Human Readable Name for this Mirror.</name>
    15. <url>http://my.repository.com/repo/path</url>
    16. </mirror>
    17. -->
    18. <mirror>
    19. <id>alimaven</id>
    20. <name>aliyun maven</name>
    21. <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    22. <mirrorOf>central</mirrorOf>
    23. </mirror>
    24. <mirror>
    25. <id>uk</id>
    26. <mirrorOf>central</mirrorOf>
    27. <name>Human Readable Name for this Mirror.</name>
    28. <url>http://uk.maven.org/maven2/</url>
    29. </mirror>
    30. <mirror>
    31. <id>CN</id>
    32. <name>OSChina Central</name>
    33. <url>http://maven.oschina.net/content/groups/public/</url>
    34. <mirrorOf>central</mirrorOf>
    35. </mirror>
    36. <mirror>
    37. <id>nexus</id>
    38. <name>internal nexus repository</name>
    39. <!-- <url>http://192.168.1.100:8081/nexus/content/groups/public/</url>-->
    40. <url>http://repo.maven.apache.org/maven2</url>
    41. <mirrorOf>central</mirrorOf>
    42. </mirror>
    43. </mirrors>
    44. </settings>