gradle生成错误:无法解析com.androidsupport:appcompat-v7:28.0.0

jbose2ul  于 2021-07-06  发布在  Java
关注(0)|答案(1)|浏览(477)

我没有正确设置回购吗?因为我希望 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()
}
nwwlzxa7

nwwlzxa71#

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()
}

虽然我不清楚不同的回购协议,我也不确定这解决了“问题”,并准备使用api。

相关问题