使用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>