我的build.gradle出現了構建錯誤。gradle - 無法從maven回購找到依賴關係
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.7
version = '1.0'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile 'org.foo.group:my-artifact:0.0.1-final'
}
組,工件和版本都是正確的。我曾與Maven項目試了一下,構建是成功的,但在項目的gradle它給了我以下錯誤:
:jar UP-TO-DATE
:assemble UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':testRuntime'.
> Could not find org.foo.group:my-artifact:0.0.1-final.
Required by:
:my-gradle-project:1.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
tlin-deploy-tool
BUILD FAILED
如果本地Maven回購包含模塊的POM,但不包含它的工件,則會發生這種情況。是這樣嗎? –
@彼得:不,這不是問題。即使您從本地回購中刪除了工件,也會引發相同的錯誤。 – mhshams
僅供參考,如果您遇到@PeterNiederwieser描述的情況,您可能會遇到[使用POM本地Maven中的Dependency並且沒有JAR文件導致依賴性解析失敗](https://issues.gradle.org/browse/ GRADLE-2709) – Alberto