gradle 无法解析:org.quickfixj:quickfixj-core

gradle Could not resolve: org.quickfixj:quickfixj-core

我的build.gradle看起来像这样

plugins {
  id 'java'
  id 'eclipse'
}

def quickfixVersion = "2.1.1"

repositories {
    mavenCentral()
    maven {
        url "http://repo.marketcetera.org/maven"
    }
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    group = 'fix'
    description = 'fix api'

    implementation 'org.quickfixj:quickfixj-core:${quickfixVersion}'
    implementation 'org.quickfixj:quickfixj-msg-fix42:${quickfixVersion}'

    implementation 'org.apache.mina:mina-core:2.1.2'
    implementation 'org.slf4j:slf4j-api:1.6.3'
    implementation 'org.slf4j:slf4j-jdk14:1.6.3'

    implementation 'com.google.code.gson:gson:2.8.6'

    implementation 'com.squareup.okhttp:okhttp:2.7.5'
    implementation 'org.projectlombok:lombok:1.16.10'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.8.3'

    testImplementation 'junit:junit:4.12'
}

test {
  useJUnitPlatform()
}

compileTestJava {
  // exclude 'fix/FixTest.java'
}

当我刷新 Gradle 项目时,它获得了除 QuickFixJ 之外的所有依赖项,但出现错误:

Could not resolve: org.quickfixj:quickfixj-core:${quickfixVersion}
Could not resolve: org.quickfixj:quickfixj-msg-fix42:${quickfixVersion}

答案是使用

repositories { mavenCentral() }

compile group: 'org.quickfixj', name: 'quickfixj-core', version: '2.1.0'
compile group: 'org.quickfixj', name: 'quickfixj-messages-fix42', version: '2.1.0'

而不是build.gradle

中的执行命令