有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Gradle搜索不需要的依赖项,因此失败

我有一个使用Gradle的多模块项目。与当前问题相关的两个项目是manray-gradle-plugin,这是一个Gradle插件项目,提供一个代码生成任务,以及manray-core,这是一个普通的Java库项目,需要前面提到的插件生成一些代码

现在,由于某种原因,我不能再编译插件项目了。它给出了以下错误:

Could not find manray:manray-core:1.0
  Searched in the following locations:
  <Long list of locations here>
Required by:
  project : > manray:manray-gradle-plugin:1.0

。。。这很奇怪,因为插件项目根本没有引用核心项目

插件项目的构建。格雷德尔是这样的:

apply plugin: 'java-library'
apply plugin: 'maven'

dependencies {
    compile gradleApi()
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.squareup:javapoet:1.9.0'
    compile 'com.github.javaparser:javaparser-core:2.5.1'
    compile 'org.reflections:reflections:0.9.10'
    compile 'io.github.lukehutch:fast-classpath-scanner:2.0.3'
}

sourceCompatibility = "1.7"
targetCompatibility = "1.7"

以及核心项目的建设。格雷德尔是这样的:

apply plugin: 'java'
apply plugin: "manray-gradle-plugin"

sourceCompatibility = "1.8"
targetCompatibility = "1.8"

ext {
    manrayOutputDir = file("$buildDir/generated-sources/manray/")
}

[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = ["src/"]

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

processComponents {
    generatedSourcesDirectory = manrayOutputDir
    classpath = sourceSets.main.compileClasspath
}
compileJava.dependsOn processComponents

最后,整个项目的建设。格雷德尔是这样的:

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        jcenter()
    }
    dependencies {
        classpath 'manray:manray-gradle-plugin:+'
    }
}

allprojects {
    apply plugin: "idea"

    version = '1.0'
    ext {
        appName = "Manray"
    }

    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    }
}

还有,设置。gradle看起来像这样:

include ':manray-gradle-plugin', ':manray-core'

什么会导致构建失败?我试着清理项目,让gradle的缓存失效。。。这里似乎什么都不管用


共 (0) 个答案