我已经将以下依赖项包括在我的Gradle项目的build.gradle文件中,以使用Vertex Ai LLM库.
implementation group: 'dev.langchain4j', name: 'langchain4j-vertex-ai', version: '0.22.0'
我在测试主功能时遇到了一个问题.
Idea IntelliJ提示符指出,它无法在com.google.guava的两个变体之间进行 Select :guava:32.1.2-jre(这是Vertex Ai依赖项的依赖项)
我收到以下错误消息
The consumer was configured to find an API of a library compatible with Java 11, preferably in the form of class files, and its dependencies declared externally.
However we cannot choose between the following variants of com.google.guava:guava:32.1.2-jre
- androidApiElements
- jreApiElements
我认为我需要使用jreApiElements变量,因为我只处理一个Web应用程序.看起来IDE很困惑,因为这两个变体提供了相同数量的参数.
All of them match the consumer attributes:
- Variant 'androidApiElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares an API of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides attribute 'org.gradle.jvm.environment' with value 'android' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'jreApiElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares an API of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
请让我知道如何 Select jreApiElements变体,同时排除androidApiElements变体.可以在build.gradle/project gradle设置中完成,因为我希望代码是可移植的.
我已经try 了以下解决方案:
-
在Gradle包装属性中设置正确的Gradle版本 文件
-
添加参数appationDefaultJvmArgs= ["-org.gradle.jvm.Environment=标准-jvm"]到build.gradle文件 (这导致构建失败,所以我删除了它)
-
在build.gradle中添加以下2个依赖项
实现组:‘com.google.cloud’,名称:‘google-cloud-aiform’,版本:‘3.24.0’
实现组:‘com.google.guava’,名称:‘guava’,版本:‘32.1.2-jre’
上述解决方案都没有奏效.请让我知道如何排除番石榴依赖的Android变体