使用gradle init --type pom命令将maven项目转为gradle管理时 范围中央仓库501
Return code is: 501 , ReasonPhrase:HTTPS Required
具体报错信息:
Could not convert Maven POM D:\project\xxl-job\pom.xml to a Gradle build.
> Unable to create Maven project model using POM D:\project\xxl-job\pom.xml.
> Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.6.7 from/to central (http://repo.m
aven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.6.7/spring-boot-starter
-parent-2.6.7.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. @ line 17, column 19
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-web:jar is missing. @ line 30, column 17
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-test:jar is missing. @ line 35, column 17
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-freemarker:jar is missing. @ line 42, column 17
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-mail:jar is missing. @ line 48, column 17
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-actuator:jar is missing. @ line 54, column 17
解决方案:
在pom文件中添加指定的仓库路径,不再使用默认的中央仓库路径
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/nexus/content/repositories/central/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/nexus/content/repositories/central/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
在尝试使用`gradleinit--typepom`命令将Maven项目转换为Gradle管理时,由于中央仓库要求HTTPS连接,导致了501错误。错误信息表明无法从http://repo.maven.apache.org/maven2下载依赖。为解决问题,文章建议在pom.xml中添加阿里云的Maven仓库,切换到HTTPS协议,以避免中央仓库的HTTPS要求。
931

被折叠的 条评论
为什么被折叠?



