gpt4 book ai didi

java - 如何解决 Groovy 与 Apache Common Logging 的冲突?

转载 作者:行者123 更新时间:2023-12-02 08:27:14 34 4
gpt4 key购买 nike

这是我的自定义 Maven Groovy 执行:

[...]
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.0-rc-5-SNAPSHOT</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<classpath>
<element>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</element
</classpath>
<source>
import org.apache.commons.httpclient.HttpClient;
// ...
</source>
</configuration>
</execution>
</executions>
</plugin>
[...]

Maven 是这么说的:

[...]
[ERROR] Failed to execute goal org.codehaus.groovy.maven:gmaven-plugin:1.0-rc-5-SNAPSHOT:execute (...) on project XXX:
java.lang.ExceptionInInitializerError: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException:
Invalid class loader hierarchy.
You have more than one version of 'org.apache.commons.logging.Log' visible,
which is not allowed.
(Caused by org.apache.commons.logging.LogConfigurationException:
Invalid class loader hierarchy.
[...]

我想我明白为什么会发生这种情况,但是我该如何解决它?

最佳答案

如果没有看到整个 pom.xml 文件,很难确切地说出如何解决这个问题,但我建议查看该标签。您可以使用如下所示的内容排除额外的依赖关系:

<plugin>
...
...
<dependencies>
<dependency>
<artifactId>...</artifactId>
<groupId>...</groupId>
<version>...</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
<exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>

关于java - 如何解决 Groovy 与 Apache Common Logging 的冲突?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4256437/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com