【问题标题】:gradle build error: Could not resolve com.android.support:appcompat-v7:28.0.0gradle 构建错误:无法解析 com.android.support:appcompat-v7:28.0.0
【发布时间】:2021-02-26 18:30:54
【问题描述】:

我不是setting up the repo's吗?因为我希望下面的springframework 很容易解决。

无法解析springframework

nicholas@mordor:~/NetBeansProjects/hello_odoo$ 
nicholas@mordor:~/NetBeansProjects/hello_odoo$ gradle clean run
> Task :app:run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:run'.
> Could not resolve all files for configuration ':app:runtimeClasspath'.
   > Could not resolve com.android.support:appcompat-v7:28.0.0.
     Required by:
         project :app > com.oogbox.api:odoo:1.0.4
      > Could not resolve com.android.support:appcompat-v7:28.0.0.
         > Could not get resource 'http://maven.springframework.org/release/com/android/support/appcompat-v7/28.0.0/appcompat-v7-28.0.0.pom'.
            > Could not GET 'http://maven.springframework.org/release/com/android/support/appcompat-v7/28.0.0/appcompat-v7-28.0.0.pom'. Received status code 403 from server: Forbidden

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2s
3 actionable tasks: 3 executed
nicholas@mordor:~/NetBeansProjects/hello_odoo$ 

gradle.build 文件:

/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java application project to get you started.
 * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
 * User Manual available at https://docs.gradle.org/6.7/userguide/building_java_projects.html
 */

plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    id 'application'
}


repositories {
  jcenter()
  mavenCentral()
  maven { url "http://maven.springframework.org/release" }
  maven { url "http://maven.restlet.org" }
}



dependencies {
    // Use TestNG framework, also requires calling test.useTestNG() below
    testImplementation 'org.testng:testng:7.2.0'

    // This dependency is used by the application.
    implementation 'com.google.guava:guava:29.0-jre'

    // https://mvnrepository.com/artifact/com.oogbox.api/odoo
    compile group: 'com.oogbox.api', name: 'odoo', version: '1.0.4'



//    providedCompile 'javax.servlet:javax.servlet-api:3.1.0' 
//    testCompile 'junit:junit:4.12'

}

application {
    // Define the main class for the application.
    mainClass = 'hello_odoo.App'
}

tasks.named('test') {
    // Use TestNG for unit tests.
    useTestNG()
}

【问题讨论】:

    标签: java maven gradle repository build.gradle


    【解决方案1】:

    hello world 至少编译并运行:

    nicholas@mordor:~/NetBeansProjects/hello_odoo$ 
    nicholas@mordor:~/NetBeansProjects/hello_odoo$ gradle clean run
    
    > Task :app:run
    Hello World!
    
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
    Use '--warning-mode all' to show the individual deprecation warnings.
    See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
    
    BUILD SUCCESSFUL in 2s
    3 actionable tasks: 3 executed
    nicholas@mordor:~/NetBeansProjects/hello_odoo$ 
    

    构建文件:

    /*
     * This file was generated by the Gradle 'init' task.
     *
     * This generated file contains a sample Java application project to get you started.
     * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
     * User Manual available at https://docs.gradle.org/6.7/userguide/building_java_projects.html
     */
    
    plugins {
        // Apply the application plugin to add support for building a CLI application in Java.
        id 'application'
    }
    
    
    repositories {
      jcenter()
      mavenCentral()
    //  maven { url "http://maven.springframework.org/release" }
    //  maven { url "http://maven.restlet.org" }
      maven { url 'https://maven.google.com' }
    
    }
    
    
    
    
    
    dependencies {
        // Use TestNG framework, also requires calling test.useTestNG() below
        testImplementation 'org.testng:testng:7.2.0'
    
        // This dependency is used by the application.
        implementation 'com.google.guava:guava:29.0-jre'
    
        // https://mvnrepository.com/artifact/com.oogbox.api/odoo
        compile group: 'com.oogbox.api', name: 'odoo', version: '1.0.4'
    
    //    providedCompile 'javax.servlet:javax.servlet-api:3.1.0' 
    //    testCompile 'junit:junit:4.12'
    
    }
    
    application {
        // Define the main class for the application.
        mainClass = 'hello_odoo.App'
    }
    
    tasks.named('test') {
        // Use TestNG for unit tests.
        useTestNG()
    }
    

    虽然我不清楚 different 存储库,但我也不确定这会解决“问题”并准备好使用 API。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-12
      • 1970-01-01
      • 2020-01-04
      • 2019-04-05
      • 2017-01-07
      相关资源
      最近更新 更多