Sey*_*eyf 1 java android gradle maven
我遇到了你所说的问题,无法编译。
A problem occurred configuring root project 'PingTv - Copy'.
> Could not resolve all files for configuration ':classpath'.
> Could not find semver4j-0.16.4-nodeps.jar (com.github.gundy:semver4j:0.16.4).
Searched in the following locations:
https://jitpack.io/com/github/gundy/semver4j/0.16.4/semver4j-0.16.4-nodeps.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Run Code Online (Sandbox Code Playgroud)
作为解决方案,我尝试了这个问题中的解决方案,但它对我不起作用。如果您有帮助,我会很高兴。
我的 Gradle 项目文件如下所示:
// Top-level build file where you can add configuration options common
to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
maven {
url "https://jitpack.io"
}
maven {
url "http://oss.sonatype.org/content/repositories/snapshots"
allowInsecureProtocol = true
}
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url "https://maven.google.com"
}
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.google.gms:google-services:4.3.14'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
configurations {
all {
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
}
}
repositories {
google()
mavenCentral()
maven {
url 'https://jitpack.io'
}
maven {
url 'https://mvnrepository.com/artifact/com.github.gundy/semver4j' //-> Add
}
maven {
url "https://dl.appnext.com/"
}
maven {
url 'https://startappdev.bintray.com/maven'
}
maven {
url "http://oss.sonatype.org/content/repositories/snapshots"
allowInsecureProtocol = true
}
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url "https://maven.google.com"
}
flatDir {
dirs 'libs'
}
}
}
Run Code Online (Sandbox Code Playgroud)
尝试直接在浏览器中访问JitPack 链接会返回以下结果:
Maven Central 上提供的工件
com.github.gundy经过进一步研究(通过在Maven Central Repository Search 网站上搜索), Maven Central 上似乎有一个有效的工件。com.github.gundy:semver4j:0.16.4
因此,您只需要将mavenCentral()存储库包含在您的build.gradle:
buildscript { // Or wherever you're using the semver4j dependency
// ...
repositories {
mavenCentral()
// Other repositories go here...
}
}
Run Code Online (Sandbox Code Playgroud)
或者在这种情况下,要修复存储库的顺序,使mavenCentral()存储库优先于 JitPack 存储库:
repositories {
mavenCentral() // This should go BEFORE JitPack
maven { url "https://jitpack.io" }
}
Run Code Online (Sandbox Code Playgroud)
顺便说一句,如果您已经包含了以下内容,则无需声明 Google Maven 存储库google():
repositories {
google() // OK
maven {
url "https://maven.google.com" // No need
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
867 次 |
| 最近记录: |