spring-cloud-netflix源码项目提示Could not find artifact org.springframework.cloud:spring-cloud-dependencie
./mvnw install执行成功之后,依赖就加载好了,这个应该是和这个项目的parent为spring-cloud-build这个有个
./mvnw install 结果
执行之后,再次执行./mvnw install
mvnw.cmd脚本到底做了什么
@REM ----------------------------------------------------------------------------
@REM maven Windows 执行脚本, 支持version 3.2.0
@REM
@REM 要求的环境变量:
@REM JAVA_HOME - JDK的主目录位置
@REM
@REM 可选的环境变量
@REM MAVEN_BATCH_ECHO - 设置为'on'以启用批处理命令的回显
@REM MAVEN_BATCH_PAUSE - 设置为'on',在结束之前等待击键
@REM MAVEN_OPTS - 运行maven时的Java虚拟机参数
@REM e.g. 调试maven使用:
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM e.g. 设置Java虚拟机启动内存
@REM set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m
@REM MAVEN_SKIP_RC - 禁用加载mavenrc文件的标志
@REM ----------------------------------------------------------------------------
@REM 关闭了命令回显功能(命令回显是指在命令执行时将命令本身显示在屏幕上)
@echo off
@REM 设置Windows窗口名称为当前命令
title %0
@REM 支持MAVEN_BATCH_ECHO环境变量命令的回显
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM HOMEDRIVE -Windows系统安装的驱动器
@REM HOMEPATH -Windows当前用户的主文件夹路径(不包括驱动器信息)
@REM 将当前用户的主文件夹路径和驱动器信息拼接起来设置为HOME变量
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM 执行下面的脚本
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM 如果文件存在,以启动参数执行下面的命令
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@setlocal
@REM ==== 启动校验 ====
@REM 如果JAVA_HOME环境变量存在,跳转到:OkJHome执行
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== 校验结束 ====
:init
@REM 找到项目基目录,即包含文件夹“.mvn”的目录
@REM 如果找不到,回退到当前工作目录
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
@REM 如果MAVEN_BASEDIR环境变量存在,跳转到endDetectBaseDir执行
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
@REM 如果当前目录下不存在.mvn文件夹,则返回上一级继续找,知道找到文件根目录,跳转到baseDirNotFound执行
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
@REM 前面会一直玩上一级目录寻找文件,找到的正确目录是WDIR变量,这里是记录.mvn文件夹所在目录位置
set MAVEN_PROJECTBASEDIR=%WDIR%
@REM 回到开始执行命令的目录,结束文件查找
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
@REM 当前目录下不存在\.mvn\jvm.config文件,MAVEN_PROJECTBASEDIR文件找到为文件位置,未找到为运行时的%CD%
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@REM 命令用于启用Windows批处理脚本中的扩展功能,以提供更多的命令扩展和变量处理能力
@setlocal EnableExtensions EnableDelayedExpansion
@REM for循环读取文件中的每一行追加到变量的后面
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
@REM 读取maven-wrapper.properties,tokens=1,2每一行的第一个和第二个标记,以=分割,第一行为wrapperUrl,将WRAPPER_URL设置为第二个值
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
)
@REM 允许从Maven-central自动下载maven-wrapper.jar的扩展
@REM T这允许在禁止检入二进制数据的项目中使用maven包装器
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %WRAPPER_URL%
)
@REM 文件下载MVNW_USERNAME,MVNW_PASSWORD不为空才下载
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM 扩展结束
@REM 如果有指定,校验Maven wrapper JAR文件的SHA-256校验和
@REM 校验和可以用于验证文件的完整性,以确保文件在下载或传输过程中没有损坏或被篡改
SET WRAPPER_SHA_256_SUM=""
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
)
@REM maven-wrapper.properties文件中有wrapperSha256Sum值
IF NOT %WRAPPER_SHA_256_SUM%=="" (
powershell -Command "&{"^
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
" exit 1;"^
"}"^
"}"
if ERRORLEVEL 1 goto error
)
@REM 提供一种“标准化”的方式来检索CLI(命令行)参数
@REM 可用于Windows和非Windows执行
set MAVEN_CMD_LINE_ARGS=%*
@REM %JAVA_HOME%\bin\java.exe -classpath %CD%\.mvn\wrapper\maven-wrapper.jar -Dmaven.multiModuleProjectDirectory%CD% org.apache.maven.wrapper.MavenWrapperMain install
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
@REM 检查最后一个执行的命令或程序的返回值(或错误码)是否大于等于 1
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM 有配置变量MAVEN_SKIP_RC才执行
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM MAVEN_BATCH_PAUSE为on则暂停脚本
@REM 暂停脚本的执行,并显示一条消息提示用户按下任意键继续执行脚本
if "%MAVEN_BATCH_PAUSE%"=="on" pause
@REM 退出关闭窗口
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
@REM /C 参数告诉 cmd 在执行完命令后立即关闭窗口,而不需要用户交互
@REM /B 参数表示退出当前批处理文件或命令,而不会结束调用该批处理文件的进程
cmd /C exit /B %ERROR_CODE%
maven配置文档:https://maven.apache.org/ref/3.9.6/maven-settings/settings.html
maven配置代理文档:https://maven.apache.org/guides/mini/guide-proxies.html
代理具体文档:https://maven.apache.org/ref/3.9.6/maven-settings/settings.html