gradle - gradle构建失败,出现异常

标签 gradle build.gradle maven-central

enter image description here

apply plugin: 'java'

group 'com.CustomWIH'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile 'org.jbpm:jbpm-kie-services:7.20.0.Final'
}

task fatJar(type: Jar) {
    baseName='jbpmTutorial'
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
    with jar
}

jbpm依赖项具有在Maven存储库中不再可用的依赖项

org.freemarker版本2.3.26 https://mvnrepository.com/artifact/org.freemarker/freemarker

C:\ Users \ kona \ IdeaProjects \ com-CustomWIH> gradle fatJar --stacktrace

失败:生成失败,发生异常。
  • 其中:
    构建文件'C:\ Users \ kona \ IdeaProjects \ com-CustomWIH \ build.gradle'行:21
  • 出了什么问题:
    无法确定任务':fatJar'的依赖性。

    Could not resolve all files for configuration ':compile'. Could not find org.freemarker:freemarker:2.3.26.jbossorg-1. Searched in the following locations:


  • 我以前从未遇到过这个问题。在这种情况下我该怎么办?

    最佳答案

    您的依赖关系树包含此传递依赖关系:org.freemarker:freemarker:2.3.26.jbossorg-1,在Maven Central中找不到。
    它在Maven Central中不存在的原因是,它不是freemarker的普通版本,而是JBoss修补版本,从依赖项2.3.26.jbossorg-1的版本可以看出。

    搜寻org.freemarker:freemarker:2.3.26.jbossorg-1,将我带到这个Maven存储库:https://repository.jboss.org/nexus/content/groups/public/

    解决方案是将这个Maven存储库添加到build.gradle中,如下所示:

    repositories {
        mavenCentral()
        maven {
            url "https://repository.jboss.org/nexus/content/groups/public/"
            // OR this one, as suggested by jb-nizet
            // url "https://maven.repository.redhat.com/ga/"
        }
    }
    

    关于gradle - gradle构建失败,出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55801072/

    相关文章:

    java - Gradle 中的 uberJar、fatJar 和 shadowJar 有什么区别?

    安卓工作室 : Add jar as library?

    scala - SBT 与 Maven Central - 在工件 url 中删除 Scala 版本

    android - dalvik.system.PathClassLoader 在 Intel 设备上找不到 jni

    android-studio - Android Studio 下载 gradle 需要永远

    java - 我如何在build.gradle文件中设置属性以在Java中访问该属性

    security - Maven 包签名或您如何信任/验证 Maven Central Artifact 的完整性和真实性?

    android - 为什么服务器/客户端套接字停止工作

    eclipse - Gradle + Buildship - 在 JAR 和项目之间切换依赖关系