Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
编译期间的不同jar版本-Gradle项目(IntelliJ和Eclipse中)_Eclipse_Intellij Idea_Gradle_Jar_Multi Module - Fatal编程技术网

编译期间的不同jar版本-Gradle项目(IntelliJ和Eclipse中)

编译期间的不同jar版本-Gradle项目(IntelliJ和Eclipse中),eclipse,intellij-idea,gradle,jar,multi-module,Eclipse,Intellij Idea,Gradle,Jar,Multi Module,我有一个使用Gradle的多模块项目。有一个模块,Data,我对Neo4J有依赖关系。它在下面使用lucene core版本3.6.2 我将此模块用作另一个模块oe中的依赖项,其中我使用Jena Text-version 1.1.2,它使用lucene core version 4.6.1。现在,我遇到了一个冲突,所以我运行了Gradle的dependencyInsight插件,并在oe模块中排除了Neo4J的依赖项,因为我不需要它们。在lucene版本4.6.1中,代码可以与gradle一起很

我有一个使用Gradle的多模块项目。有一个模块,Data,我对Neo4J有依赖关系。它在下面使用lucene core版本3.6.2

我将此模块用作另一个模块oe中的依赖项,其中我使用Jena Text-version 1.1.2,它使用lucene core version 4.6.1。现在,我遇到了一个冲突,所以我运行了Gradle的dependencyInsight插件,并在oe模块中排除了Neo4J的依赖项,因为我不需要它们。在lucene版本4.6.1中,代码可以与gradle一起很好地编译

问题是,每当我试图在oe模块中编写代码时,我都会从lucence 3.6.2中获得自动完成的建议,但当Gradle最终编译它时,它会在corect版本(即4.6.1)中执行

例如,我想用Lucene编写自己的分析器。编写分析器的方式已从3.6版更改为4.6版。现在编码变得很困难,如果我的IDE一直告诉我,我正在基于我最终不会使用的jar编写错误的代码。这在IntelliJ Idea 13、企业版和Eclipse Luna中都发生了

我就是这样把他们排除在外的

compile(project(":data")){
    exclude group:'org.springframework.data', module: 'spring-data-neo4j-rest'
    exclude group:'org.springframework.data', module: 'spring-data-neo4j'

}
这是在我的oe模块中运行DependencyInsight for lucene core的结果

/oe$ gradle -q dependencyInsight --configuration compile --dependency lucene-core
org.apache.lucene:lucene-core:4.6.1
+--- compile
+--- org.apache.jena:jena-text:1.1.2
|    \--- compile
+--- org.apache.lucene:lucene-analyzers-common:4.6.1
|    +--- compile
|    \--- org.apache.jena:jena-text:1.1.2 (*)
+--- org.apache.lucene:lucene-queries:4.6.1
|    \--- org.apache.lucene:lucene-queryparser:4.6.1
|         \--- org.apache.jena:jena-text:1.1.2 (*)
+--- org.apache.lucene:lucene-queryparser:4.6.1 (*)
\--- org.apache.lucene:lucene-sandbox:4.6.1
 \--- org.apache.lucene:lucene-queryparser:4.6.1 (*)

(*) - dependencies omitted (listed previously)

intellij
中,您可以通过单击
项目结构
中模块的
依赖项
选项卡上的向上/向下箭头来确定它使用哪个jar的优先级。不太理想,但应该可以解决代码完成问题。

在intellij中,您可以通过单击项目结构中模块的依赖项选项卡上的上/下箭头来确定它使用哪个jar的优先级。不理想,但应该修复代码完成问题。按照您所说的,解决了问题。谢谢。也许你应该把它作为一个答案发布,这样我就可以接受了。老鼠,我们也有同样的问题,但在我们的例子中,我们要求的正确版本甚至不在列表中,所以我们不能只是重新排列libs来获得一个工作设置。