英文:
log4j-slf4j-impl cannot be present with log4j-to-slf4j --- after adding graphql dependency to pom
问题
我正在尝试使用GraphQL并将其集成到我们现有的项目中。由于我们的项目是使用Java和Spring框架的,所以我在遵循这个教程。
但是在添加了以下依赖后:
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>5.0.2</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-tools</artifactId>
<version>5.2.4</version>
</dependency>
并且尝试启动项目时,我遇到了错误:
Caused by: org.apache.logging.log4j.LoggingException: log4j-slf4j-impl
cannot be present with log4j-to-slf4j
我在这里和这里找到了类似的帖子。这些帖子导致我尝试添加排除项,但并没有帮助:
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>5.0.2</version>
<exclusions>
<exclusion>
<groupId>log4j-slf4j-impl</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>log4j-to-slf4j</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
英文:
Im trying mess around with graph ql and integrating it with our existing project. Im following this tutorial since our project is java with spring framework
but after adding the dependencies
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>5.0.2</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-tools</artifactId>
<version>5.2.4</version>
</dependency>
and trying to start my project i get an error
> Caused by: org.apache.logging.log4j.LoggingException: log4j-slf4j-impl
> cannot be present with log4j-to-slf4j
I have found similar post here, and here
Which lead me to attempt to add exclusions but that did NOT help
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>5.0.2</version>
<exclusions>
<exclusion>
<groupId>log4j-slf4j-impl</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>log4j-to-slf4j</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
答案1
得分: 1
排除的依赖关系 groupId 似乎不正确。 将被排除的 groupId 更改为 org.apache.logging.log4j 可能会解决您的问题。
英文:
Excluded dependencies groupId seems wrong. Changing excluded groupId's to org.apache.logging.log4j may solve your problem.
答案2
得分: 0
我最终使用了:
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>5.0.2</version>
</dependency>
英文:
i ended up using
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>5.0.2</version>
</dependency>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论