我的 maven settings.xml 如下。如您所見,沒有 http 存盤庫 url。所有存盤庫 url 都以 https 開頭。
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>mirror</id>
<mirrorOf>central,jcenter,!rdc-releases,!rdc-snapshots</mirrorOf>
<name>mirror</name>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
<servers>
<server>
<id>rdc-releases</id>
<username>myUserName</username>
<password>myPwd</password>
</server>
<server>
<id>rdc-snapshots</id>
<username>myUserName</username>
<password>myPwd</password>
</server>
</servers>
<profiles>
<profile>
<id>rdc</id>
<properties>
<altReleaseDeploymentRepository>
rdc-releases::default::https://packages.aliyun.com/maven/repository/2012878-release-sX3W6A/
</altReleaseDeploymentRepository>
<altSnapshotDeploymentRepository>
rdc-snapshots::default::https://packages.aliyun.com/maven/repository/2012878-snapshot-wXHWRP/
</altSnapshotDeploymentRepository>
</properties>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>rdc-releases</id>
<url>https://packages.aliyun.com/maven/repository/2012878-release-sX3W6A/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>rdc-snapshots</id>
<url>https://packages.aliyun.com/maven/repository/2012878-snapshot-wXHWRP/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>rdc</activeProfile>
</activeProfiles>
</settings>
當我執行 gradle build 時,它說我使用了不安全的協議。事實上,我從不在我的 maven settings.xml 中使用 http 協議。我們可以看到所有存盤庫 url 都以“https://”開頭。任何人都可以給我一些建議嗎?
## Exception is
> Task :buildSrc:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildSrc:compileJava'.
> Could not resolve all dependencies for configuration ':buildSrc:compileClasspath'.
> Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(http://maven.aliyun.com/nexus/content/groups/public)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.4/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.
我的 gradle 版本是 7.4,部分 build.gradle 如下。這是一個多模塊專案。我以一個模塊 gradle 設定為例。
設定.gradle
/*
* This file was generated by the Gradle 'init' task.
*/
rootProject.name = 'clougence-schema-parent'
include(':clougence-utils')
clougence-utils 模塊的 build.gradle
/*
* This file was generated by the Gradle 'init' task.
*/
plugins {
id 'com.clougence.java-conventions'
}
description = 'clougence-utils'
時髦的紙條
/*
* This file was generated by the Gradle 'init' task.
*/
plugins {
id 'java-library'
id 'maven-publish'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compileOnly 'org.slf4j:slf4j-api:1.7.30'
compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.20'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.20'
testCompileOnly 'org.projectlombok:lombok:1.18.20'
testImplementation 'com.alibaba:druid:1.2.6'
testImplementation 'junit:junit:4.12'
testImplementation 'net.hasor:hasor-db:4.3.0'
testImplementation 'com.alibaba:druid:1.2.6'
}
group = 'com.clougence'
version = '1.0.12-SNAPSHOT'
java.sourceCompatibility = JavaVersion.VERSION_1_8
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
uj5u.com熱心網友回復:
我自己找到答案。我曾經配置 ~/.gradle/init.gradle 并設定一個 http url 強制 gradle 使用那個不安全的存盤庫
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/429868.html
