57 lines
2.1 KiB
Python
57 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|||
|
|
import os
|
||
|
|
import urllib.request
|
||
|
|
import ssl
|
||
|
|
import xml.etree.ElementTree as ET
|
||
|
|
|
||
|
|
ssl._create_default_https_context = ssl._create_unverified_context
|
||
|
|
|
||
|
|
REPO_URL = "https://repo1.maven.org/maven2"
|
||
|
|
LOCAL_REPO = "E:/develop/公益婚恋服务平台/backend/local-maven"
|
||
|
|
|
||
|
|
# Dependencies to download (groupId:artifactId:version)
|
||
|
|
DEPS = [
|
||
|
|
("org.springframework.boot", "spring-boot-starter-web", "3.2.5"),
|
||
|
|
("org.springframework.boot", "spring-boot-starter-validation", "3.2.5"),
|
||
|
|
("org.springframework.boot", "spring-boot-starter-security", "3.2.5"),
|
||
|
|
("org.springframework.boot", "spring-boot-starter-data-redis", "3.2.5"),
|
||
|
|
("org.springframework.boot", "spring-boot-starter-websocket", "3.2.5"),
|
||
|
|
("org.postgresql", "postgresql", "42.7.1"),
|
||
|
|
("com.baomidou", "mybatis-plus-spring-boot3-starter", "3.5.5"),
|
||
|
|
("org.flywaydb", "flyway-core", "9.22.3"),
|
||
|
|
("io.jsonwebtoken", "jjwt-api", "0.12.5"),
|
||
|
|
("io.jsonwebtoken", "jjwt-impl", "0.12.5"),
|
||
|
|
("io.jsonwebtoken", "jjwt-jackson", "0.12.5"),
|
||
|
|
("org.projectlombok", "lombok", "1.18.30"),
|
||
|
|
("org.mapstruct", "mapstruct", "1.5.5.Final"),
|
||
|
|
("org.mapstruct", "mapstruct-processor", "1.5.5.Final"),
|
||
|
|
("org.springdoc", "springdoc-openapi-starter-webmvc-ui", "2.3.0"),
|
||
|
|
]
|
||
|
|
|
||
|
|
def download_artifact(group_id, artifact_id, version, classifier=""):
|
||
|
|
rel_path = group_id.replace(".", "/")
|
||
|
|
filename = f"{artifact_id}-{version}"
|
||
|
|
if classifier:
|
||
|
|
filename += f"-{classifier}"
|
||
|
|
filename += ".jar"
|
||
|
|
|
||
|
|
url = f"{REPO_URL}/{rel_path}/{artifact_id}/{version}/{filename}"
|
||
|
|
local_path = f"{LOCAL_REPO}/{rel_path}/{artifact_id}/{version}/{filename}"
|
||
|
|
|
||
|
|
os.makedirs(os.path.dirname(local_path), exist_ok=True)
|
||
|
|
|
||
|
|
try:
|
||
|
|
print(f"Downloading {filename}...")
|
||
|
|
urllib.request.urlretrieve(url, local_path)
|
||
|
|
print(f" Saved to {local_path}")
|
||
|
|
return True
|
||
|
|
except Exception as e:
|
||
|
|
print(f" Failed: {e}")
|
||
|
|
return False
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
print("Downloading Maven dependencies...")
|
||
|
|
for gid, aid, ver in DEPS:
|
||
|
|
download_artifact(gid, aid, ver)
|
||
|
|
print("Done!")
|