mave转gradle访问仓库501

在尝试使用`gradleinit--typepom`命令将Maven项目转换为Gradle管理时,由于中央仓库要求HTTPS连接,导致了501错误。错误信息表明无法从http://repo.maven.apache.org/maven2下载依赖。为解决问题,文章建议在pom.xml中添加阿里云的Maven仓库,切换到HTTPS协议,以避免中央仓库的HTTPS要求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用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>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值