settings-offline.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. 观澜 · Java 后端离线构建设置(可移植)。
  4. 目标机/本机可能没有外网 ⇒ 构件全部来自"用户本地仓"(由 settings-online.xml 事先下好)。
  5. ★ 实逮(2026-09-29):本地仓会为每个构件记来源仓库 id(`_remote.repositories`)。若离线设置的
  6. mirror/repository id 与当初下载时**不一致**,`mvn -o` 会报 "Cannot access central in offline mode",
  7. 哪怕 jar 就在本地。所以这里保留与 settings-online.xml **同名**的 id(aliyun-public),
  8. 并且构建命令另加 `-Dmaven.legacyLocalRepo=true`(本地仓权威,不按来源挑剔)。
  9. 用法:mvn -s app_backEnd/backend-java/settings-offline.xml -o -Dmaven.legacyLocalRepo=true compile
  10. (`${user.home}` 写法 —— 仓里不写死某台机器的盘符;构件在别处时用环境变量 GUANLAN_MVN_SETTINGS 覆盖)
  11. -->
  12. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  13. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  14. xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
  15. <localRepository>${user.home}/.m2/repository</localRepository>
  16. <offline>true</offline>
  17. <mirrors>
  18. <mirror>
  19. <id>aliyun-public</id>
  20. <name>Aliyun public (与联机下载时同名,离线解析才认)</name>
  21. <url>https://maven.aliyun.com/repository/public</url>
  22. <mirrorOf>central</mirrorOf>
  23. </mirror>
  24. </mirrors>
  25. <profiles>
  26. <profile>
  27. <id>guanlan-offline</id>
  28. <repositories>
  29. <repository>
  30. <id>aliyun-public-direct</id>
  31. <url>https://maven.aliyun.com/repository/public</url>
  32. <releases><enabled>true</enabled></releases>
  33. <snapshots><enabled>false</enabled></snapshots>
  34. </repository>
  35. <repository>
  36. <id>central-direct</id>
  37. <url>https://repo.maven.apache.org/maven2</url>
  38. <releases><enabled>true</enabled></releases>
  39. <snapshots><enabled>false</enabled></snapshots>
  40. </repository>
  41. </repositories>
  42. </profile>
  43. </profiles>
  44. <activeProfiles>
  45. <activeProfile>guanlan-offline</activeProfile>
  46. </activeProfiles>
  47. </settings>